public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37924]  New: ice in smallest_mode_for_size, at stor-layout.c:219
@ 2008-10-27  3:28 regehr at cs dot utah dot edu
  2008-10-27 11:02 ` [Bug c/37924] [4.2/4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: regehr at cs dot utah dot edu @ 2008-10-27  3:28 UTC (permalink / raw)
  To: gcc-bugs

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

regehr@john-home:~/volatile/tmp51$ current-gcc -O small.c
small.c: In function ‘func_142’:
small.c:15: internal compiler error: in smallest_mode_for_size, at
stor-layout.c:219
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@john-home:~/volatile/tmp51$ current-gcc -v

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --program-prefix=current-
--enable-languages=c,c++ --prefix=/home/regehr
Thread model: posix
gcc version 4.4.0 20081027 (experimental) (GCC) 

regehr@john-home:~/volatile/tmp51$ cat small.c

inline int
rshift_u_s (unsigned int left, int right)
{
  return left >> right;
}

char g_95;
const int g_126 = 9L;

int
func_142 (int p_143, int p_144, int p_145, int p_146)
{
  int l_152 = -1;
  if (lshift_u_u (func_26 (rshift_u_s (g_95 ^ l_152, g_126)), 1));
}


-- 
           Summary: ice in smallest_mode_for_size, at stor-layout.c:219
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: regehr at cs dot utah dot edu
 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=37924


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

* [Bug c/37924] [4.2/4.3/4.4 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
@ 2008-10-27 11:02 ` rguenth at gcc dot gnu dot org
  2008-10-27 12:40 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-27 11:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-10-27 11:01 -------
(gdb) up
#1  0x08491138 in smallest_mode_for_size (size=4294967295, class=MODE_INT)
    at /home/richard/src/gcc-4_3-branch/gcc/stor-layout.c:219
219       gcc_unreachable ();

#3  0x0898cb61 in make_compound_operation (x=0xb7caf300, in_code=COMPARE)
    at /home/richard/src/gcc-4_3-branch/gcc/combine.c:7030
7030              new = make_extraction (mode, new,
(gdb) l
7025              && GET_CODE (lhs) == ASHIFT
7026              && GET_CODE (XEXP (lhs, 1)) == CONST_INT
7027              && INTVAL (rhs) >= INTVAL (XEXP (lhs, 1)))
7028            {
7029              new = make_compound_operation (XEXP (lhs, 0), next_code);
7030              new = make_extraction (mode, new,
7031                                     INTVAL (rhs) - INTVAL (XEXP (lhs, 1)),
7032                                     NULL_RTX, mode_width - INTVAL (rhs),
7033                                     code == LSHIFTRT, 0, in_code ==
COMPARE);
7034              break;
(gdb) call debug_rtx (rhs)
(const_int 33 [0x21])
(gdb) call debug_rtx (lhs)
(ashift:SI (subreg:SI (mem/c/i:QI (symbol_ref:SI ("g_95") <var_decl 0xb7c3c1b8
g_95>) [0 g_95+0 S1 A8]) 0)
    (const_int 24 [0x18]))


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.2.4 4.3.2 4.4.0
      Known to work|                            |4.1.2
   Last reconfirmed|0000-00-00 00:00:00         |2008-10-27 11:01:06
               date|                            |
            Summary|ice in                      |[4.2/4.3/4.4 Regression] ice
                   |smallest_mode_for_size, at  |in smallest_mode_for_size,
                   |stor-layout.c:219           |at stor-layout.c:219
   Target Milestone|---                         |4.2.5


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


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

* [Bug c/37924] [4.2/4.3/4.4 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
  2008-10-27 11:02 ` [Bug c/37924] [4.2/4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2008-10-27 12:40 ` jakub at gcc dot gnu dot org
  2008-10-27 13:54 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-27 12:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2008-10-27 12:38 -------
Reduced testcase:
char a;

int
test (void)
{
  int b = -1;
  return ((unsigned int) (a ^ b)) >> 9;
}


-- 


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


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

* [Bug c/37924] [4.2/4.3/4.4 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
  2008-10-27 11:02 ` [Bug c/37924] [4.2/4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
  2008-10-27 12:40 ` jakub at gcc dot gnu dot org
@ 2008-10-27 13:54 ` jakub at gcc dot gnu dot org
  2008-10-27 18:55 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-27 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-10-27 13:53 -------
I see at least 2 bugs.  One is simplify_shift_const "optimizes"
(lshiftrt:SI (xor:SI (ashiftrt:SI (ashift:SI (subreg:SI (mem/c/i:QI
(symbol_ref:DI ("a") <var_decl 0x7ffff33f0820 a>) [0 a+0 S1 A8]) 0)
                (const_int 24 [0x18]))
            (const_int 24 [0x18]))
        (const_int -512 [0xfffffffffffffe00]))
    (const_int 9 [0x9]))
into invalid:
(and:SI (not:SI (ashiftrt:SI (ashift:SI (subreg:SI (mem/c/i:QI (symbol_ref:DI
("a") <var_decl 0x7ffff33f0820 a>) [0 a+0 S1 A8]) 0)
                (const_int 24 [0x18]))
            (const_int 33 [0x21])))
    (const_int 8388607 [0x7fffff]))
(it should IMHO never create a shift bigger than precision, as that has
undefined behavior, while the original did not have one).
The other bug is that make_compound_operation should && mode_width >= INTVAL
(rhs), even if the user passes in undefined behavior code, GCC shouldn't ICE on
it.


-- 

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|2008-10-27 11:01:06         |2008-10-27 13:53:09
               date|                            |


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


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

* [Bug c/37924] [4.2/4.3/4.4 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (2 preceding siblings ...)
  2008-10-27 13:54 ` jakub at gcc dot gnu dot org
@ 2008-10-27 18:55 ` pinskia at gcc dot gnu dot org
  2008-10-28 19:05 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-27 18:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-10-27 18:54 -------
As an asside, I wonder why we don't optimize:
  D.1576_3 = (int) a.0_2;
  D.1577_4 = ~D.1576_3;
  D.1578_5 = (unsigned int) D.1577_4;

Into just:
D_1 = ~a.0_2;
D_2 = (unsigned int)D_1;

Like it is done for the case were we manually replace b with -1.  Maybe this is
a tree combiner issue again ...


-- 


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


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

* [Bug c/37924] [4.2/4.3/4.4 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (3 preceding siblings ...)
  2008-10-27 18:55 ` pinskia at gcc dot gnu dot org
@ 2008-10-28 19:05 ` jakub at gcc dot gnu dot org
  2008-10-28 19:07 ` [Bug c/37924] [4.2/4.3 " jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-28 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2008-10-28 19:04 -------
Subject: Bug 37924

Author: jakub
Date: Tue Oct 28 19:02:36 2008
New Revision: 141413

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141413
Log:
        PR c/37924
        * combine.c (make_compound_operation): Don't call make_extraction with
        non-positive length.
        (simplify_shift_const_1): Canonicalize count even if complement_p.

        * gcc.c-torture/execute/pr37924.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr37924.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/37924] [4.2/4.3 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (4 preceding siblings ...)
  2008-10-28 19:05 ` jakub at gcc dot gnu dot org
@ 2008-10-28 19:07 ` jakub at gcc dot gnu dot org
  2008-11-03 11:28 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-28 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2008-10-28 19:06 -------
Fixed in 4.4 so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.2.4 4.3.2 4.4.0           |4.2.4 4.3.2
      Known to work|4.1.2                       |4.1.2 4.4.0
            Summary|[4.2/4.3/4.4 Regression] ice|[4.2/4.3 Regression] ice in
                   |in smallest_mode_for_size,  |smallest_mode_for_size, at
                   |at stor-layout.c:219        |stor-layout.c:219


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


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

* [Bug c/37924] [4.2/4.3 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (5 preceding siblings ...)
  2008-10-28 19:07 ` [Bug c/37924] [4.2/4.3 " jakub at gcc dot gnu dot org
@ 2008-11-03 11:28 ` jakub at gcc dot gnu dot org
  2008-11-05 20:45 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-03 11:28 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c/37924] [4.2/4.3 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (6 preceding siblings ...)
  2008-11-03 11:28 ` jakub at gcc dot gnu dot org
@ 2008-11-05 20:45 ` jakub at gcc dot gnu dot org
  2008-11-05 20:48 ` jakub at gcc dot gnu dot org
  2009-03-31 15:50 ` [Bug c/37924] [4.2 " jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-05 20:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2008-11-05 20:44 -------
Subject: Bug 37924

Author: jakub
Date: Wed Nov  5 20:42:43 2008
New Revision: 141621

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141621
Log:
        PR c/37924
        * combine.c (make_compound_operation): Don't call make_extraction with
        non-positive length.
        (simplify_shift_const_1): Canonicalize count even if complement_p.

        * gcc.c-torture/execute/pr37924.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr37924.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/combine.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/37924] [4.2/4.3 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (7 preceding siblings ...)
  2008-11-05 20:45 ` jakub at gcc dot gnu dot org
@ 2008-11-05 20:48 ` jakub at gcc dot gnu dot org
  2009-03-31 15:50 ` [Bug c/37924] [4.2 " jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-05 20:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2008-11-05 20:46 -------
Fixed on 4.3 branch as well.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jakub at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
      Known to work|4.1.2 4.4.0                 |4.1.2 4.4.0 4.3.3


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


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

* [Bug c/37924] [4.2 Regression] ice in smallest_mode_for_size, at stor-layout.c:219
  2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
                   ` (8 preceding siblings ...)
  2008-11-05 20:48 ` jakub at gcc dot gnu dot org
@ 2009-03-31 15:50 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 15:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2009-03-31 15:50 -------
Closing 4.2 branch, fixed for 4.3.3 and 4.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.2.4 4.3.2                 |4.2.4 4.3.2 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.3


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


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

end of thread, other threads:[~2009-03-31 15:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27  3:28 [Bug c/37924] New: ice in smallest_mode_for_size, at stor-layout.c:219 regehr at cs dot utah dot edu
2008-10-27 11:02 ` [Bug c/37924] [4.2/4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2008-10-27 12:40 ` jakub at gcc dot gnu dot org
2008-10-27 13:54 ` jakub at gcc dot gnu dot org
2008-10-27 18:55 ` pinskia at gcc dot gnu dot org
2008-10-28 19:05 ` jakub at gcc dot gnu dot org
2008-10-28 19:07 ` [Bug c/37924] [4.2/4.3 " jakub at gcc dot gnu dot org
2008-11-03 11:28 ` jakub at gcc dot gnu dot org
2008-11-05 20:45 ` jakub at gcc dot gnu dot org
2008-11-05 20:48 ` jakub at gcc dot gnu dot org
2009-03-31 15:50 ` [Bug c/37924] [4.2 " jsm28 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).