This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/37872] New: ICE in extract_bit_field_1


Reproducing this is easy.

cat > ICE.sample.c <<'EOF'
typedef unsigned int size_t;

extern void *memcpy (void *__restrict __dest,
       __const void *__restrict __src, size_t __n)
     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));

unsigned xxx(long double arg)
{
        struct
        {
                char dummy[8];
                unsigned yyy:7;
        } copy;
        memcpy(&copy, &arg, sizeof(copy));
        return copy.yyy;
}
EOF

invoking 'gcc -c -O1 sample.c' then emits
/home/bernard/ICE.sample.c: In function ?xxx?:
/home/bernard/ICE.sample.c:8: internal compiler error: in extract_bit_field_1,
at expmed.c:1271
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

This is quite sensitive!  Small changes make the ICE
go away.  These include
 using -O0
 re-sizing the array member dummy[] in the struct
 Replacing the memcpy() with an assignment via a
    cast pointer:
       give the struct a tag (e.g., struct fimbulwinter)
       copy = *((struct fimbulwinter *)&arg)
 renaming memcpy() at both occurrences to by-pass the built-in

The last is suggestive, no?

This is NOT a duplicate of bug 37269, though the ICE is reported from
the same function.  I get the same behaviour after applying Andrew
Pinski's patch for that bug.  In fact, I found this bug in an echt
4.3.1 bootstrap build, applied AP's patch, still had it, then used
that compiler to bootstrap a 4.3.2 build, also with AP's patch.
Even using xgcc/cc1 from the stage 1 boostrap build of 4.3.2
showed the bug (there was nothing extra interesting in the
diagnostics produced).

'configure' was invoked with

'../gcc-4.3.2/configure' '--prefix=/usr' '--libexecdir=/usr/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--enable-libada'
'--enable-libssp' '--disable-werror' '--with-mpfr=/usr' '--with-gmp=/usr'
'--with-datarootdir=/usr/share' '--with-docdir=/usr/share/gcc-4.3.2/doc'
'--with-pdfdir=/usr/share/gcc-4.3.2/doc'
'--with-htmldir=/usr/share/gcc-4.3.2/doc/html' '--disable-coverage'
'--enable-nls' '--enable-__cxa_atexit' '--enable-decimal-float'
'--disable-fixed-point' '--enable-threads=posix' '--enable-clocale=gnu'
'--enable-shared' '--disable-intermodule'
'--enable-languages=ada,c++,fortran,java,objc,obj-c++,treelang,c'
'--with-local-prefix=/usr' '--with-gnu-ld' '--with-demangler-in-ld'
'--with-gnu-as' '--with-system-libunwind' '--with-system-zlib'
'--enable-bootstrap'

All those single quotes derive from my build scripts, which quote-and-
escape everything in sight.  The actual CPU is an Athlon64 X2 5600+
(the 2.9GHz flavour, not the 2.8GHz flavour).
My binutils are from release 2.18, built with an unpatched gcc-4.3.1 .


-- 
           Summary: ICE in extract_bit_field_1
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bernard at brenda-arkle dot me dot uk
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37872


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]