Bug 53278 - [4.8 regression] internal compiler error: in df_uses_record, at df-scan.c:3179 when compiling libgcc2.c __mulvdi3 on armv5tel-linux
Summary: [4.8 regression] internal compiler error: in df_uses_record, at df-scan.c:317...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Richard Sandiford
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-08 09:00 UTC by Mikael Pettersson
Modified: 2012-05-08 21:52 UTC (History)
4 users (show)

See Also:
Host:
Target: arm
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-05-08 00:00:00


Attachments
Preprocessed source. ICEs with -O1 and above, but not with -Os. (27.17 KB, application/octet-stream)
2012-05-08 09:00 UTC, Mikael Pettersson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Pettersson 2012-05-08 09:00:07 UTC
Created attachment 27343 [details]
Preprocessed source.  ICEs with -O1 and above, but not with -Os.

Attempting to bootstrap gcc-4.8-20120506 on armv5tel-linux fails with:

/mnt/scratch/objdir48/./gcc/xgcc -B/mnt/scratch/objdir48/./gcc/ -B/mnt/scratch/install48/armv5tel-unknown-linux-gnueabi/bin/ -B/mnt/scratch/install48/armv5tel-unknown-linux-gnueabi/lib/ -isystem /mnt/scratch/install48/armv5tel-unknown-linux-gnueabi/include -isystem /mnt/scratch/install48/armv5tel-unknown-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fPIC -fno-inline -I. -I. -I../.././gcc -I/mnt/scratch/gcc-4.8-20120506/libgcc -I/mnt/scratch/gcc-4.8-20120506/libgcc/. -I/mnt/scratch/gcc-4.8-20120506/libgcc/../gcc -I/mnt/scratch/gcc-4.8-20120506/libgcc/../include  -DHAVE_CC_TLS  -o _mulvdi3.o -MT _mulvdi3.o -MD -MP -MF _mulvdi3.dep -DL_mulvdi3 -c /mnt/scratch/gcc-4.8-20120506/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
/mnt/scratch/gcc-4.8-20120506/libgcc/libgcc2.c: In function '__mulvdi3':
/mnt/scratch/gcc-4.8-20120506/libgcc/libgcc2.c:397:1: internal compiler error: in df_uses_record, at df-scan.c:3179
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [_mulvdi3.o] Error 1
make[3]: Leaving directory `/mnt/scratch/objdir48/armv5tel-unknown-linux-gnueabi/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/mnt/scratch/objdir48'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/mnt/scratch/objdir48'
make: *** [bootstrap] Error 2

gcc-4.8-20120422 did bootstrap Ok, 4.8-20120429 failed due to breakage with the armhf dynamic linker changes.

Configuration parameters:
/mnt/scratch/gcc-4.8-20120506/configure --prefix=/mnt/scratch/install48 --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,fortran,ada --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --disable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --disable-sjlj-exceptions --with-arch=armv5te --with-tune=xscale --build=armv5tel-unknown-linux-gnueabi --disable-plugin --disable-lto --disable-libmudflap --disable-build-poststage1-with-cxx
Comment 1 Richard Earnshaw 2012-05-08 09:27:59 UTC
the subreg splitting pass is generating concatn in the insn stream.  The manual says this isn't allowed.
Comment 2 Ramana Radhakrishnan 2012-05-08 14:03:37 UTC
Here's a reduced testcase from newlib where I hit the same issue. 

struct _reent
{
  int _errno;
};
typedef unsigned int wchar_t;
unsigned long long
_wcstoull_r(struct _reent *rptr , const wchar_t *nptr , wchar_t **endptr , int base)
{
 register const wchar_t *s = nptr;
 register unsigned long long acc;
 register int c;
 register unsigned long long cutoff;
 register int neg = 0, any, cutlim;
 if(base < 0 
    || base == 1 
    || base > 36) {
  return(0ULL);
 }
 if ((base == 0 || base == 16) &&
     c == L'0' && (*s == L'x' || *s == L'X')) {
  c = s[1];
 }
 if (base == 0)
  base = c == L'0' ? 8 : 10;
 cutoff = (unsigned long long)(9223372036854775807LL * 2ULL + 1ULL) / (unsigned long long)base;
 for (acc = 0, any = 0;; c = *s++) {
  if (iswdigit(c))
   break;
  if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
   any = -1;
  else {
   acc += c;
  }
 }
 if (any < 0) {
  rptr->_errno = 34;
 } else if (neg)
  acc = -acc;
}
Comment 3 Ramana Radhakrishnan 2012-05-08 14:56:18 UTC
The patch below appears to trigger the issue but there's a fundamental question as to why lower-subreg generates concatns when the documentation suggests that concat and concatn should only be used in declarations but not in the insn stream. 


http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00423.html
Comment 4 Kenneth Zadeck 2012-05-08 15:43:37 UTC
Ramana, 

I did not write this pass.  I believe that iant did.  he used concatn and concat as a temp marker in the rtl and if all went well, these are all removed before the pass finishes.   Obviously something is no longer going well so we will have to look into it.  

Kenny
Comment 5 Richard Sandiford 2012-05-08 18:42:47 UTC
My fault (again).
Comment 6 Richard Sandiford 2012-05-08 21:42:09 UTC
Author: rsandifo
Date: Tue May  8 21:42:03 2012
New Revision: 187299

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187299
Log:
gcc/
	PR rtl-optimization/53278
	* lower-subreg.c (decompose_multiword_subregs): Remove left-over
	speed_p code from earlier patch.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lower-subreg.c
Comment 7 Richard Sandiford 2012-05-08 21:52:36 UTC
Fixed.