public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37870]  New: ICE in extract_bit_field_1
@ 2008-10-19 11:48 bernard at brenda-arkle dot me dot uk
  2008-10-19 12:42 ` [Bug middle-end/37870] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: bernard at brenda-arkle dot me dot uk @ 2008-10-19 11:48 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3222 bytes --]

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=37870


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-11-05 20:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-19 11:48 [Bug c/37870] New: ICE in extract_bit_field_1 bernard at brenda-arkle dot me dot uk
2008-10-19 12:42 ` [Bug middle-end/37870] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2008-10-19 12:51 ` rguenth at gcc dot gnu dot org
2008-10-19 13:58 ` bernard at brenda-arkle dot me dot uk
2008-10-19 14:41 ` bernard at brenda-arkle dot me dot uk
2008-10-22  3:49 ` mmitchel at gcc dot gnu dot org
2008-10-25 18:44 ` rguenth at gcc dot gnu dot org
2008-10-29 15:01 ` jakub at gcc dot gnu dot org
2008-10-29 16:08 ` jakub at gcc dot gnu dot org
2008-10-29 16:09 ` [Bug middle-end/37870] [4.3 " jakub at gcc dot gnu dot org
2008-11-05 20:36 ` jakub at gcc dot gnu dot org
2008-11-05 20:46 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).