Bug 65678

Summary: [5 Regression] internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:909
Product: gcc Reporter: David Kredba <nheghathivhistha>
Component: debugAssignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: cas43, jakub
Priority: P1    
Version: 5.0   
Target Milestone: 5.0   
Host: Target: x86_64-*-*
Build: Known to work:
Known to fail: Last reconfirmed: 2015-04-06 00:00:00
Attachments: Preprocessed source file
gcc5-pr65678.patch

Description David Kredba 2015-04-06 17:34:50 UTC
Created attachment 35236 [details]
Preprocessed source file

I can't compile debug enabled Gentoo Mozilla Firefox 37.0.1 package with Gcc-5.0 trunk revision 221871:

srv5 mfbt # x86_64-pc-linux-gnu-g++ -o Unified_cpp_mfbt0.o -c  -I../dist/system_wrappers -include /var/tmp/portage/www-client/firefox-37.0.1/work/mozilla-release/config/gcc_hidden.h -DIMPL_MFBT -DMOZ_GLUE_IN_PROGRAM -DAB_CD=en-US -DNO_NSPR_10_SUPPORT -I/var/tmp/portage/www-client/firefox-37.0.1/work/mozilla-release/mfbt -I.  -I../dist/include   -I/usr/include/nspr -I/usr/include/nss    -I/usr/include/pixman-1    -fPIC   -DMOZILLA_CLIENT -include ../mozilla-config.h -MD -MP -MF .deps/Unified_cpp_mfbt0.o.pp  -Wall -Wempty-body -Woverloaded-virtual -Wsign-compare -Wwrite-strings -Wno-invalid-offsetof -Wcast-align -ggdb -pipe -march=core2 -mtune=core2 -mno-avx -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -pipe  -DDEBUG -DTRACING -g -freorder-blocks -Os  -fno-omit-frame-pointer      /var/tmp/portage/www-client/firefox-37.0.1/work/mozilla-release/ff/mfbt/Unified_cpp_mfbt0.cpp --save-temps
x86_64-pc-linux-gnu-g++: warning: -pipe ignored because -save-temps specified
In file included from /var/tmp/portage/www-client/firefox-37.0.1/work/mozilla-release/ff/mfbt/Unified_cpp_mfbt0.cpp:110:0:
/var/tmp/portage/www-client/firefox-37.0.1/work/mozilla-release/mfbt/double-conversion/fixed-dtoa.cc: In function ‘bool double_conversion::FastFixedDtoa(double, int, double_conversion::Vector<char>, int*, int*)’:
/var/tmp/portage/www-client/firefox-37.0.1/work/mozilla-release/mfbt/double-conversion/fixed-dtoa.cc:400:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:909
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions.

gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/5.0.0/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-5.0.0/work/gcc-5.0.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/5.0.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.0.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.0.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.0.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.0.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.0.0/include/g++-v5 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/5.0.0/python --enable-languages=c,c++,fortran,ada --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 5.0.0' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --enable-lto --with-isl --disable-isl-version-check --enable-libsanitizer
Thread model: posix
gcc version 5.0.0 20150405 (experimental) [trunk revision 221871] (Gentoo 5.0.0)

Attaching ii file now and will try to reduce it.
Comment 1 David Kredba 2015-04-06 17:45:27 UTC
C-reduced test case:

extern "C" void *memmove(void *, const void *, unsigned long);
long a;
template <class, class Source> int BitCast(Source &p1) {
  memmove(&a, &p1, sizeof a);
  return a;
}

static int double_to_uint64(double p1) { return BitCast<int>(p1); }

class A {
public:
  A(double p1) : d64_(double_to_uint64(p1)) {}
  int m_fn1();
  int m_fn2() {
    int b;
    b = d64_;
    if (b)
      return 0;
  }
  int d64_;
};

void FillFractionals();
void FastFixedDtoa(double p1) {
  int c = A(p1).m_fn2(), d = A(p1).m_fn1();
  if (d)
    FillFractionals();
}
Comment 2 Uroš Bizjak 2015-04-06 19:59:26 UTC
Confirmed:

$ /ssd/uros/gcc-build/gcc/cc1plus -Os -ggdb -quiet pr65678.C
pr65678.C: In function ‘void FastFixedDtoa(double)’:
pr65678.C:28:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:909
 }
 ^
0x9936fb gen_rtx_SUBREG(machine_mode, rtx_def*, int)
        /home/uros/gcc-svn/trunk/gcc/emit-rtl.c:909
0xf2bc16 dead_debug_insert_temp(dead_debug_local*, unsigned int, rtx_insn*, debug_temp_where)
        /home/uros/gcc-svn/trunk/gcc/valtrack.c:743
0x93079d df_note_bb_compute
        /home/uros/gcc-svn/trunk/gcc/df-problems.c:3179
0x93079d df_note_compute
        /home/uros/gcc-svn/trunk/gcc/df-problems.c:3286
0x92b730 df_analyze_problem(dataflow*, bitmap_head*, int*, int)
        /home/uros/gcc-svn/trunk/gcc/df-core.c:1205
0x92b828 df_analyze_1
        /home/uros/gcc-svn/trunk/gcc/df-core.c:1265
0x1244c91 rest_of_handle_dse
        /home/uros/gcc-svn/trunk/gcc/dse.c:3736
0x1244c91 execute
        /home/uros/gcc-svn/trunk/gcc/dse.c:3837
Please submit a full bug report,
Comment 3 Jakub Jelinek 2015-04-06 20:01:30 UTC
Started with r215450.
Comment 4 Jakub Jelinek 2015-04-07 09:23:02 UTC
Created attachment 35242 [details]
gcc5-pr65678.patch

Untested fix.
Comment 5 Jakub Jelinek 2015-04-07 14:35:50 UTC
Author: jakub
Date: Tue Apr  7 14:35:18 2015
New Revision: 221900

URL: https://gcc.gnu.org/viewcvs?rev=221900&root=gcc&view=rev
Log:
	PR debug/65678
	* valtrack.c (debug_lowpart_subreg): New function.
	(dead_debug_insert_temp): Use it.

	* g++.dg/debug/pr65678.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/debug/pr65678.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/valtrack.c
Comment 6 Jakub Jelinek 2015-04-07 14:48:42 UTC
Fixed.
Comment 7 Vladimir Makarov 2015-04-07 15:01:39 UTC
Author: vmakarov
Date: Tue Apr  7 15:01:07 2015
New Revision: 221901

URL: https://gcc.gnu.org/viewcvs?rev=221901&root=gcc&view=rev
Log:
2015-04-07  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/65678
	* lra-remat.c (do_remat): Process input and non-input insn
	registers separately.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra-remat.c
Comment 8 Andrew Pinski 2021-07-24 23:53:32 UTC
*** Bug 58537 has been marked as a duplicate of this bug. ***