public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40204]  New: segfault with bitfields in structs
@ 2009-05-19 22:16 gcc-bugzilla at gcc dot gnu dot org
  2009-05-20  9:20 ` [Bug middle-end/40204] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2009-05-19 22:16 UTC (permalink / raw)
  To: gcc-bugs


        Compiling the following (nonsense but valid) code triggers an internal
        compiler error.

Environment:
System: Linux thanatos 2.6.26-2-686-bigmem #1 SMP Thu Mar 26 02:03:34 UTC 2009 
i686 GNU/Linux

How-To-Repeat:
        Compile the following:

        -- snip --
        struct s {
            unsigned int a : 4;
            unsigned int b : 28;
        };

        void f()
        {
            char c;
            struct s s;
            s.a = (c >> 4) & ~(1<<4);
        }
        -- snip --

        $ gcc -Wall -c bug.c 
        gcc: Internal error: Segmentation fault (program cc1)
        Please submit a full bug report.
        See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.


------- Comment #1 from michael at walle dot cc  2009-05-19 22:16 -------
Fix:
        not known


-- 
           Summary: segfault with bitfields in structs
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael at walle dot cc


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


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

* [Bug middle-end/40204] [4.3/4.4/4.5 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
@ 2009-05-20  9:20 ` rguenth at gcc dot gnu dot org
  2009-05-20 16:12 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-20  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-05-20 09:20 -------
Confirmed.  We endlessly recurse in folding

#2  0x000000000076b333 in fold_binary (code=BIT_AND_EXPR, type=0x7ffff5f5f540, 
    op0=0x7ffff7ff9580, op1=0x7ffff5f76870)
    at /space/rguenther/src/svn/trunk/gcc/fold-const.c:11388
11388                     return fold_build2 (BIT_AND_EXPR, type, tem,
(gdb) l
11383                                            TREE_OPERAND (arg0, 1));
11384                         tem = fold_convert (type, tem);
11385                       }
11386                     else
11387                       tem = op0;
11388                     return fold_build2 (BIT_AND_EXPR, type, tem,
11389                                         build_int_cst_type (TREE_TYPE
(op1),
11390                                                             newmask));
11391                   }
11392               }
(gdb) call debug_generic_expr (op0)
(<unnamed-unsigned:4>) ((unsigned char) c >> 4)
(gdb) call debug_generic_expr (op1)
15
(gdb) call debug_generic_expr (tem)
(<unnamed-unsigned:4>) ((unsigned char) c >> 4)
(gdb) p newmask
$1 = 255

and 255 is truncated to 15 again.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |middle-end
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.3.3 4.4.0
      Known to work|                            |4.2.4
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-20 09:20:22
               date|                            |
            Summary|segfault with bitfields in  |[4.3/4.4/4.5 Regression]
                   |structs                     |segfault with bitfields in
                   |                            |structs
   Target Milestone|---                         |4.3.4


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


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

* [Bug middle-end/40204] [4.3/4.4/4.5 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
  2009-05-20  9:20 ` [Bug middle-end/40204] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2009-05-20 16:12 ` jakub at gcc dot gnu dot org
  2009-05-20 21:09 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-20 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-05-20 16:11 -------
As I've caused this by PR29749, I'm taking this up.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-05-20 09:20:22         |2009-05-20 16:11:59
               date|                            |


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


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

* [Bug middle-end/40204] [4.3/4.4/4.5 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
  2009-05-20  9:20 ` [Bug middle-end/40204] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
  2009-05-20 16:12 ` jakub at gcc dot gnu dot org
@ 2009-05-20 21:09 ` jakub at gcc dot gnu dot org
  2009-05-20 21:11 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-20 21:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-05-20 21:09 -------
Subject: Bug 40204

Author: jakub
Date: Wed May 20 21:09:11 2009
New Revision: 147749

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147749
Log:
        PR middle-end/40204
        * fold-const.c (fold_binary) <case BIT_AND_EXPR>: Avoid infinite
        recursion if build_int_cst_type returns the same INTEGER_CST as
        arg1.

        * gcc.c-torture/compile/pr40204.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr40204.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/40204] [4.3/4.4/4.5 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-05-20 21:09 ` jakub at gcc dot gnu dot org
@ 2009-05-20 21:11 ` jakub at gcc dot gnu dot org
  2009-05-20 21:15 ` [Bug middle-end/40204] [4.3 " jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-20 21:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-05-20 21:11 -------
Subject: Bug 40204

Author: jakub
Date: Wed May 20 21:11:10 2009
New Revision: 147750

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147750
Log:
        PR middle-end/40204
        * fold-const.c (fold_binary) <case BIT_AND_EXPR>: Avoid infinite
        recursion if build_int_cst_type returns the same INTEGER_CST as
        arg1.

        * gcc.c-torture/compile/pr40204.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr40204.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/fold-const.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/40204] [4.3 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-05-20 21:11 ` jakub at gcc dot gnu dot org
@ 2009-05-20 21:15 ` jakub at gcc dot gnu dot org
  2009-06-17 21:03 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-20 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2009-05-20 21:15 -------
Fixed for 4.4/4.5 so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3/4.4/4.5 Regression]    |[4.3 Regression] segfault
                   |segfault with bitfields in  |with bitfields in structs
                   |structs                     |


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


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

* [Bug middle-end/40204] [4.3 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-05-20 21:15 ` [Bug middle-end/40204] [4.3 " jakub at gcc dot gnu dot org
@ 2009-06-17 21:03 ` rguenth at gcc dot gnu dot org
  2009-06-19 17:17 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-17 21:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug middle-end/40204] [4.3 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-06-17 21:03 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 17:17 ` rguenth at gcc dot gnu dot org
  2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
  2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-06-19 17:17 -------
Testing a backport.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jakub at gcc dot gnu dot org|rguenth at gcc dot gnu dot
                   |                            |org


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


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

* [Bug middle-end/40204] [4.3 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 21:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2009-06-19 21:45 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|4.2.4                       |4.2.4 4.3.4 4.4.1 4.5.0
         Resolution|                            |FIXED


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


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

* [Bug middle-end/40204] [4.3 Regression] segfault with bitfields in structs
  2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-06-19 17:17 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
  2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 21:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-06-19 21:44 -------
Subject: Bug 40204

Author: rguenth
Date: Fri Jun 19 21:44:24 2009
New Revision: 148730

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148730
Log:
2009-06-19  Richard Guenther  <rguenther@suse.de>

        Backport from mainline:
        2009-02-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/36607
        * convert.c (convert_to_integer): Treat OFFSET_TYPE like INTEGER_TYPE.

        * g++.dg/expr/cast10.C: New test.

        2009-02-03  Jakub Jelinek  <jakub@redhat.com>

        PR target/35318
        * function.c (match_asm_constraints_1): Skip over
        initial optional % in the constraint.

        * gcc.c-torture/compile/pr35318.c: New test.

        2009-05-20  Jakub Jelinek  <jakub@redhat.com>

        PR middle-end/40204
        * fold-const.c (fold_binary) <case BIT_AND_EXPR>: Avoid infinite
        recursion if build_int_cst_type returns the same INTEGER_CST as
        arg1.

        * gcc.c-torture/compile/pr40204.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/expr/cast10.C
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/compile/pr35318.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/compile/pr40204.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/convert.c
    branches/gcc-4_3-branch/gcc/fold-const.c
    branches/gcc-4_3-branch/gcc/function.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2009-06-19 21:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-19 22:16 [Bug c/40204] New: segfault with bitfields in structs gcc-bugzilla at gcc dot gnu dot org
2009-05-20  9:20 ` [Bug middle-end/40204] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
2009-05-20 16:12 ` jakub at gcc dot gnu dot org
2009-05-20 21:09 ` jakub at gcc dot gnu dot org
2009-05-20 21:11 ` jakub at gcc dot gnu dot org
2009-05-20 21:15 ` [Bug middle-end/40204] [4.3 " jakub at gcc dot gnu dot org
2009-06-17 21:03 ` rguenth at gcc dot gnu dot org
2009-06-19 17:17 ` rguenth at gcc dot gnu dot org
2009-06-19 21:45 ` rguenth at gcc dot gnu dot org
2009-06-19 21:45 ` rguenth 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).