PR middle-end/85496 80/211180/4 accepted/tizen/base/20190805.091708 submit/tizen_base/20190801.003618
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Apr 2018 20:19:39 +0000 (20:19 +0000)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 31 Jul 2019 06:55:05 +0000 (15:55 +0900)
commit718f30af33ffafbcafb1fbe90967489d4ffabc26
tree3d2fa8abb5df0c65da915f6df233c295a8fab2c4
parent30255a5854a11a5e67c13b640d65a80411a34a39
PR middle-end/85496

* expr.c (store_field): In the bitfield case, if the value comes from
a function call and is returned in registers by means of a PARALLEL,
do not change the mode of the temporary unless BLKmode and VOIDmode.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259574 138bc75d-0d04-0410-961f-82ee72b054a4

This Fix is from gcc-mainline (branch for gcc-6)
Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85496
Fix report: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=259577
Related issue of tensorflow: https://github.com/tensorflow/tensorflow/issues/25323

Related build errors in Tizen (tensorflow / aarch64):

    [ 3281s]   exec env - \
    [ 3281s]     LD_LIBRARY_PATH=/usr/lib64 \
    [ 3281s]     PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/home/abuild/rpmbuild/BUILD/tensorflow-v1.13.1 \
    [ 3281s]     PWD=/proc/self/cwd \
    [ 3281s]     PYTHON_BIN_PATH=/bin/python \
    [ 3281s]     PYTHON_LIB_PATH=/usr/lib/python2.7/site-packages \
    [ 3281s]     TF_DOWNLOAD_CLANG=0 \
    [ 3281s]     TF_NEED_CUDA=0 \
    [ 3281s]     TF_NEED_OPENCL_SYCL=0 \
    [ 3281s]     TF_NEED_ROCM=0 \
    [ 3281s]   /bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/aarch64-opt/bin/tensorflow/compiler/xla/service/cpu/_objs/runtime_conv2d/runtime_conv2d.pic.d '-frandom-seed=bazel-out/aarch64-opt/bin/tensorflow/compiler/xla/service/cpu/_objs/runtime_conv2d/runtime_conv2d.pic.o' -fPIC -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_ALIGN_BYTES=64' '-DEIGEN_HAS_TYPE_TRAITS=0' -iquote . -iquote bazel-out/aarch64-opt/genfiles -iquote bazel-out/aarch64-opt/bin -iquote external/nsync -iquote bazel-out/aarch64-opt/genfiles/external/nsync -iquote bazel-out/aarch64-opt/bin/external/nsync -iquote external/bazel_tools -iquote bazel-out/aarch64-opt/genfiles/external/bazel_tools -iquote bazel-out/aarch64-opt/bin/external/bazel_tools -iquote external/eigen_archive -iquote bazel-out/aarch64-opt/genfiles/external/eigen_archive -iquote bazel-out/aarch64-opt/bin/external/eigen_archive -iquote external/local_config_sycl -iquote bazel-out/aarch64-opt/genfiles/external/local_config_sycl -iquote bazel-out/aarch64-opt/bin/external/local_config_sycl -isystem external/nsync/public -isystem bazel-out/aarch64-opt/genfiles/external/nsync/public -isystem bazel-out/aarch64-opt/bin/external/nsync/public -isystem external/eigen_archive -isystem bazel-out/aarch64-opt/genfiles/external/eigen_archive -isystem bazel-out/aarch64-opt/bin/external/eigen_archive '-march=armv8-a+fp+simd+crc+crypto' -Wno-sign-compare '-D_GLIBCXX_USE_CXX11_ABI=0' '-std=c++11' -DEIGEN_AVOID_STL_ARRAY -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/compiler/xla/service/cpu/runtime_conv2d.cc -o bazel-out/aarch64-opt/bin/tensorflow/compiler/xla/service/cpu/_objs/runtime_conv2d/runtime_conv2d.pic.o)
    [ 3281s] In file included from external/eigen_archive/Eigen/Core:296:0,
    [ 3281s]                  from ./third_party/eigen3/Eigen/Core:1,
    [ 3281s]                  from ./tensorflow/compiler/xla/service/cpu/runtime_conv2d.h:19,
    [ 3281s]                  from tensorflow/compiler/xla/service/cpu/runtime_conv2d.cc:16:
    [ 3281s] external/eigen_archive/Eigen/src/Core/products/GeneralBlockPanelKernel.h: In member function 'void Eigen::internal::gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, nr, ConjugateLhs, ConjugateRhs>::operator()(const DataMapper&, const LhsScalar*, const RhsScalar*, Index, Index, Index, Eigen::internal::gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, nr, ConjugateLhs, ConjugateRhs>::ResScalar, Index, Index, Index, Index) [with LhsScalar = Eigen::half; RhsScalar = Eigen::half; Index = long int; DataMapper = Eigen::internal::blas_data_mapper<Eigen::half, long int, 0, 0>; int mr = 2; int nr = 4; bool ConjugateLhs = false; bool ConjugateRhs = false]':
    [ 3281s] external/eigen_archive/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1879:3: internal compiler error: in emit_move_insn, at expr.c:3547
    [ 3281s]    }
    [ 3281s]    ^
    [ 3281s] Please submit a full bug report,
    [ 3281s] with preprocessed source if appropriate.
    [ 3281s] See <http://bugs.tizen.org/> for instructions.
    [ 3284s] Target //tensorflow/tools/lib_package:libtensorflow failed to build
    [ 3284s] INFO: Elapsed time: 3254.811s, Critical Path: 366.23s, Remote (0.00% of the time): [queue: 0.00%, setup: 0.00%, process: 0.00%]
    [ 3284s] INFO: 1643 processes: 1643 local.
    [ 3284s] FAILED: Build did NOT complete successfully
    [ 3284s] FAILED: Build did NOT complete successfully
    [ 3285s] error: Bad exit status from /var/tmp/rpm-tmp.YdwJ8i (%build)

Because this fix requires yet another older fix, part of the older fix
is merged from the following mainline commit.

Author: rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>  2017-08-30 20:10:44
Committer: rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>  2017-08-30 20:10:44
Parent: 2cf1bb2548bf9ce652251e4f7870e67b080acf56 ([18/77] Make int_mode_for_mode return an opt_scalar_int_mode)
Child:  8b449599ee018840a92725b17e06374b0f8787c0 ([20/77] Replace MODE_INT checks with is_int_mode)
   [19/77] Add a smallest_int_mode_for_size helper function

Change-Id: I5e22ed657099d7a1ac19b451c436f8e4831c6c76
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr85496.C [new file with mode: 0644]