public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385
@ 2013-01-03  1:05 jan.smets@alcatel-lucent.com
  2013-01-03  1:28 ` [Bug middle-end/55851] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-01-03  1:05 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55851
           Summary: ICE in size_binop_loc, at fold-const.c:1385
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jan.smets@alcatel-lucent.com


Created attachment 29074
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29074
testcase

Trunk, testcase attached.


/tmp/ice.c: In function 'test':
/tmp/ice.c:36:45: internal compiler error: in size_binop_loc, at
fold-const.c:1385
                     if ((found_bit_mask[dqs][word] & (1 << j)) == 0)
                                             ^
0x6de9b5 size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*)
        ../../trunk/gcc/fold-const.c:1385
0x74c4ec gimplify_compound_lval
        ../../trunk/gcc/gimplify.c:2239
0x744f5f gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7146
0x7442b5 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7459
0x74530b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7814
0x74530b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7814
0x74530b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7814
0x7512bc gimplify_cond_expr
        ../../trunk/gcc/gimplify.c:3285
0x74542d gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7150
0x74d978 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../trunk/gcc/gimplify.c:5726
0x7449e3 gimplify_statement_list
        ../../trunk/gcc/gimplify.c:1562
0x7449e3 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7583
0x74d978 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../trunk/gcc/gimplify.c:5726
0x74e898 gimplify_bind_expr
        ../../trunk/gcc/gimplify.c:1254
0x7455fe gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7365
0x74d978 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../trunk/gcc/gimplify.c:5726
0x751845 gimplify_cond_expr
        ../../trunk/gcc/gimplify.c:3349
0x74542d gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../trunk/gcc/gimplify.c:7150
0x74d978 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../trunk/gcc/gimplify.c:5726
0x7449e3 gimplify_statement_list
        ../../trunk/gcc/gimplify.c:1562


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

* [Bug middle-end/55851] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
@ 2013-01-03  1:28 ` pinskia at gcc dot gnu.org
  2013-01-03  1:33 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-03  1:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-03 01:28:28 UTC ---
What options are you using and what is the target?


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

* [Bug middle-end/55851] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
  2013-01-03  1:28 ` [Bug middle-end/55851] " pinskia at gcc dot gnu.org
@ 2013-01-03  1:33 ` pinskia at gcc dot gnu.org
  2013-01-03  1:36 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-03  1:33 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-03 01:33:19 UTC ---
This works for me on x86_64-linux-gnu with revision 194774.


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

* [Bug middle-end/55851] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
  2013-01-03  1:28 ` [Bug middle-end/55851] " pinskia at gcc dot gnu.org
  2013-01-03  1:33 ` pinskia at gcc dot gnu.org
@ 2013-01-03  1:36 ` pinskia at gcc dot gnu.org
  2013-01-03  1:42 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-03  1:36 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Target|                            |i?86-*-*

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-03 01:36:09 UTC ---
apinski@apinskidesktop:~$ ./gcc-126/bin/gcc ice.c  -m32
ice.c: In function ‘test’:
ice.c:36:45: internal compiler error: in size_binop_loc, at fold-const.c:1385
                     if ((found_bit_mask[dqs][word] & (1 << j)) == 0) 

Needed -m32.


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

* [Bug middle-end/55851] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (2 preceding siblings ...)
  2013-01-03  1:36 ` pinskia at gcc dot gnu.org
@ 2013-01-03  1:42 ` pinskia at gcc dot gnu.org
  2013-01-03  1:48 ` [Bug middle-end/55851] [4.8 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-03  1:42 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-03 01:42:37 UTC ---
Confirmed reduced testcase:
enum { A=1 } something = A;
void test(void)
{
    char found_bit_mask[1][something];
    found_bit_mask[0][0] = 1;
}

--- CUT ----
Fails with:
GNU C (GCC) version 4.8.0 20121127 (experimental) [trunk revision 193870]
(x86_64-unknown-linux-gnu)


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (3 preceding siblings ...)
  2013-01-03  1:42 ` pinskia at gcc dot gnu.org
@ 2013-01-03  1:48 ` pinskia at gcc dot gnu.org
  2013-01-03 11:16 ` [Bug c/55851] " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-03  1:48 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-03
      Known to work|                            |4.7.0
   Target Milestone|---                         |4.8.0
            Summary|ICE in size_binop_loc, at   |[4.8 Regression] ICE in
                   |fold-const.c:1385           |size_binop_loc, at
                   |                            |fold-const.c:1385
     Ever Confirmed|0                           |1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-03 01:47:47 UTC ---
Confirmed a regression from 4.7.0.


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

* [Bug c/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (4 preceding siblings ...)
  2013-01-03  1:48 ` [Bug middle-end/55851] [4.8 Regression] " pinskia at gcc dot gnu.org
@ 2013-01-03 11:16 ` rguenth at gcc dot gnu.org
  2013-01-03 14:48 ` [Bug middle-end/55851] " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-03 11:16 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |c

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-03 11:15:57 UTC ---
Confirmed.  TYPE_SIZE_UNIT of the ARRAY_TYPE is not of sizetype.

 <array_type 0x7ffff68e01f8
    type <integer_type 0x7ffff67f63f0 char sizes-gimplified public string-flag
QI
        size <integer_cst 0x7ffff67e2f00 constant 8>
        unit size <integer_cst 0x7ffff67e2f20 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x7ffff67f63f0 precision 8
min <integer_cst 0x7ffff67e2f60 -128> max <integer_cst 0x7ffff67e2fa0 127>
        pointer_to_this <pointer_type 0x7ffff68033f0>>
    sizes-gimplified type_1 BLK
    size <var_decl 0x7ffff68cf7b8 D.1378
        type <integer_type 0x7ffff67f60a8 bitsizetype public unsigned DI
...
    unit size <var_decl 0x7ffff68cf4c0 something.0
        type <enumeral_type 0x7ffff68e0000 unsigned type_0 SI
...

oops.

C frontend bug.


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (5 preceding siblings ...)
  2013-01-03 11:16 ` [Bug c/55851] " rguenth at gcc dot gnu.org
@ 2013-01-03 14:48 ` jakub at gcc dot gnu.org
  2013-01-03 15:32 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-03 14:48 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
          Component|c                           |middle-end

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-03 14:47:37 UTC ---
The C FE is innocent, it has TYPE_SIZE_UNIT <nop_expr sizetype <something>>.
The problem is in the gimplifier, gimplify_one_sizepos, because sizetype is
types_compatible_p with the ENUMERAL_TYPE (with -m32), replaces the sizetype
typed TYPE_SIZE_UNIT with the enumeral one.  So, either we'd need to special
case this in gimplify_one_sizepos or so and if it turns an INTEGER_TYPE expr
into something with different type TREE_CODE, do something (what exactly?  If
we turn it into a NOP_EXPR of the VAR_DECL, it will not satisfy
is_gimple_sizepos and we'll try to regimplify it again and again, or shall we
adjust is_gimple_sizepos too to allow that special case of a NOP_EXPR of
is_gimple_sizepos if the types are compatible?).  Or adjust whatever code is
assuming that TYPE_SIZE_UNIT must be INTEGER_TYPE.


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (6 preceding siblings ...)
  2013-01-03 14:48 ` [Bug middle-end/55851] " jakub at gcc dot gnu.org
@ 2013-01-03 15:32 ` jakub at gcc dot gnu.org
  2013-01-03 16:32 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-03 15:32 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-03 15:32:16 UTC ---
Created attachment 29078
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29078
gcc48-pr55851.patch

Untested patch (which I don't like very much, but we can't even use something
like get_initialized_tmp_var which would strip the cast as useless too).


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (7 preceding siblings ...)
  2013-01-03 15:32 ` jakub at gcc dot gnu.org
@ 2013-01-03 16:32 ` rguenth at gcc dot gnu.org
  2013-01-07 15:46 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-03 16:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-03 16:32:04 UTC ---
Ehm.  (In reply to comment #8)
> Created attachment 29078 [details]
> gcc48-pr55851.patch
> 
> Untested patch (which I don't like very much, but we can't even use something
> like get_initialized_tmp_var which would strip the cast as useless too).

Ugh.  Now that sizetypes are no longer "special" we can also decide to
allow ENUMERAL_TYPE in size positions (and adjust int_binop_types_match_p).

But I'm not sure if we really want non-literal-sizetype sizes in type
trees (they will easily appear in the extra operands of ARRAY_REF and
COMPONENT_REF though, so maybe it's really the right thing to do).

Otherwise using a get_initialized_tmp_var-like mechanism should be ok
as long as you explicitely create the temporary variable with sizetype
(I don't see that it strips the cast before getting at the type to
create the temporary?)


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (8 preceding siblings ...)
  2013-01-03 16:32 ` rguenth at gcc dot gnu.org
@ 2013-01-07 15:46 ` rguenth at gcc dot gnu.org
  2013-01-08  8:32 ` jakub at gcc dot gnu.org
  2013-01-08  8:46 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-07 15:46 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (9 preceding siblings ...)
  2013-01-07 15:46 ` rguenth at gcc dot gnu.org
@ 2013-01-08  8:32 ` jakub at gcc dot gnu.org
  2013-01-08  8:46 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-08  8:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-08 08:32:21 UTC ---
Author: jakub
Date: Tue Jan  8 08:32:12 2013
New Revision: 195006

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195006
Log:
    PR middle-end/55851
    * fold-const.c (int_binop_types_match_p): Allow all INTEGRAL_TYPE_P
    types instead of just INTEGER_TYPE types.

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

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


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

* [Bug middle-end/55851] [4.8 Regression] ICE in size_binop_loc, at fold-const.c:1385
  2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
                   ` (10 preceding siblings ...)
  2013-01-08  8:32 ` jakub at gcc dot gnu.org
@ 2013-01-08  8:46 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-08  8:46 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-08 08:45:27 UTC ---
Fixed.


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

end of thread, other threads:[~2013-01-08  8:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03  1:05 [Bug middle-end/55851] New: ICE in size_binop_loc, at fold-const.c:1385 jan.smets@alcatel-lucent.com
2013-01-03  1:28 ` [Bug middle-end/55851] " pinskia at gcc dot gnu.org
2013-01-03  1:33 ` pinskia at gcc dot gnu.org
2013-01-03  1:36 ` pinskia at gcc dot gnu.org
2013-01-03  1:42 ` pinskia at gcc dot gnu.org
2013-01-03  1:48 ` [Bug middle-end/55851] [4.8 Regression] " pinskia at gcc dot gnu.org
2013-01-03 11:16 ` [Bug c/55851] " rguenth at gcc dot gnu.org
2013-01-03 14:48 ` [Bug middle-end/55851] " jakub at gcc dot gnu.org
2013-01-03 15:32 ` jakub at gcc dot gnu.org
2013-01-03 16:32 ` rguenth at gcc dot gnu.org
2013-01-07 15:46 ` rguenth at gcc dot gnu.org
2013-01-08  8:32 ` jakub at gcc dot gnu.org
2013-01-08  8:46 ` jakub at gcc dot gnu.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).