public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
@ 2020-03-15 12:18 marxin at gcc dot gnu.org
  2020-03-15 12:19 ` [Bug c/94179] " marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-15 12:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

            Bug ID: 94179
           Summary: [10 Regression] ICE in gimplify_expr, at
                    gimplify.c:14399 since r10-7127-gcb99630f254aaec6
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

I see the following ICE isolated from xf86-video-intel package:

$ cat kgem.i
struct kgem_bo {
  int rq;
  int list;
  int pinned_batches[];
} a;

void
fn1() {
  int b = (struct kgem_bo *)((char *)a.pinned_batches[b > 4096] -
                             (char *)&((struct kgem_bo *)0)->list);
}

$ gcc kgem.i -c
kgem.i: In function ‘fn1’:
kgem.i:9:30: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
    9 |   int b = (struct kgem_bo *)((char *)a.pinned_batches[b > 4096] -
      |                              ^
kgem.i:9:11: warning: initialization of ‘int’ from ‘struct kgem_bo *’ makes
integer from pointer without a cast [-Wint-conversion]
    9 |   int b = (struct kgem_bo *)((char *)a.pinned_batches[b > 4096] -
      |           ^
kgem.i:9:57: internal compiler error: in gimplify_expr, at gimplify.c:14399
    9 |   int b = (struct kgem_bo *)((char *)a.pinned_batches[b > 4096] -
      |                                                       ~~^~~~~~
0x69d747 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:14399
0xb83ce1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:14369
0xb8409f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13705
0xb8b079 gimplify_compound_lval
        /home/marxin/Programming/gcc/gcc/gimplify.c:3079
0xb83845 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13554
0xb8409f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13705
0xb8409f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13705
0xb8641e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13761
0xb8c625 gimplify_addr_expr
        /home/marxin/Programming/gcc/gcc/gimplify.c:6171
0xb84284 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13649
0xb8409f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13705
0xb8409f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13705
0xb81ce7 gimplify_modify_expr
        /home/marxin/Programming/gcc/gcc/gimplify.c:5766
0xb83e98 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13602
0xb87976 gimplify_stmt(tree_node**, gimple**)
        /home/marxin/Programming/gcc/gcc/gimplify.c:6823
0xb90518 gimplify_and_add(tree_node*, gimple**)
        /home/marxin/Programming/gcc/gcc/gimplify.c:486
0xb90518 gimplify_decl_expr
        /home/marxin/Programming/gcc/gcc/gimplify.c:1816
0xb8509d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/marxin/Programming/gcc/gcc/gimplify.c:13799
0xb87976 gimplify_stmt(tree_node**, gimple**)
        /home/marxin/Programming/gcc/gcc/gimplify.c:6823
0xb886fe gimplify_bind_expr
        /home/marxin/Programming/gcc/gcc/gimplify.c:1424
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c/94179] [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
  2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
@ 2020-03-15 12:19 ` marxin at gcc dot gnu.org
  2020-03-15 12:31 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-15 12:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
      Known to fail|                            |10.0
            Version|9.0                         |10.0
   Last reconfirmed|                            |2020-03-15
      Known to work|                            |9.3.0
   Target Milestone|---                         |10.0
           Priority|P3                          |P1

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

* [Bug c/94179] [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
  2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
  2020-03-15 12:19 ` [Bug c/94179] " marxin at gcc dot gnu.org
@ 2020-03-15 12:31 ` marxin at gcc dot gnu.org
  2020-03-15 16:31 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-15 12:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
A better test-case:

struct kgem_bo {
  int rq;
  int list;
  int pinned_batches[];
} a;
int b;
void fn1() {
  (struct kgem_bo *)((char *)&a.pinned_batches[b > 4096] -
                     (char *)&((struct kgem_bo *)0)->list);
}

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

* [Bug c/94179] [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
  2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
  2020-03-15 12:19 ` [Bug c/94179] " marxin at gcc dot gnu.org
  2020-03-15 12:31 ` marxin at gcc dot gnu.org
@ 2020-03-15 16:31 ` jakub at gcc dot gnu.org
  2020-03-16  7:41 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-15 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48036
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48036&action=edit
gcc10-pr94179.patch

Untested fix.
And/or we could limit the match.pd optimization to GIMPLE only, as at least the
C FE doesn't seem to be prepared to handle MEM_REFs and it is unclear if this
is the only spot that needs fixing.

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

* [Bug c/94179] [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
  2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-15 16:31 ` jakub at gcc dot gnu.org
@ 2020-03-16  7:41 ` rguenth at gcc dot gnu.org
  2020-03-16 21:59 ` cvs-commit at gcc dot gnu.org
  2020-03-16 22:00 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-16  7:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Created attachment 48036 [details]
> gcc10-pr94179.patch
> 
> Untested fix.
> And/or we could limit the match.pd optimization to GIMPLE only, as at least
> the C FE doesn't seem to be prepared to handle MEM_REFs and it is unclear if
> this is the only spot that needs fixing.

Doing it GIMPLE only may need additional "fixes" when people disable
forwprop though (didn't check).  IMHO the FEs better deal with all GENERIC
if they call into middle-end routines.  But I'm not against doing this
and I don't think we need to care about people doing -fno-tree-forwprop,
it's just you brought it up ... ;)

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

* [Bug c/94179] [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
  2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-16  7:41 ` rguenth at gcc dot gnu.org
@ 2020-03-16 21:59 ` cvs-commit at gcc dot gnu.org
  2020-03-16 22:00 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-16 21:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c015ff8ccaf3ee8e4f6393679ed790ed0df92873

commit r10-7198-gc015ff8ccaf3ee8e4f6393679ed790ed0df92873
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Mar 16 22:58:41 2020 +0100

    c: Handle MEM_REF in c_fully_fold* [PR94179]

    The recent match.pd changes can generate a MEM_REF which can be seen by the
    C FE folding routines.  Unlike the C++ FE, they weren't expected in the C
FE
    yet.  MEM_REF should be handled like INDIRECT_REF, except that it has two
    operands rather than just one and that we should preserve the type of the
    second operand.  Given that it already has to be an INTEGER_CST with
pointer
    type, I think we are fine, the recursive call should return the INTEGER_CST
    unmodified and STRIP_TYPE_NOPS will not strip anything.

    2020-03-16  Jakub Jelinek  <jakub@redhat.com>

            PR c/94179
            * c-fold.c (c_fully_fold_internal): Handle MEM_REF.

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

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

* [Bug c/94179] [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6
  2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-03-16 21:59 ` cvs-commit at gcc dot gnu.org
@ 2020-03-16 22:00 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 22:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94179

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-03-16 22:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 12:18 [Bug c/94179] New: [10 Regression] ICE in gimplify_expr, at gimplify.c:14399 since r10-7127-gcb99630f254aaec6 marxin at gcc dot gnu.org
2020-03-15 12:19 ` [Bug c/94179] " marxin at gcc dot gnu.org
2020-03-15 12:31 ` marxin at gcc dot gnu.org
2020-03-15 16:31 ` jakub at gcc dot gnu.org
2020-03-16  7:41 ` rguenth at gcc dot gnu.org
2020-03-16 21:59 ` cvs-commit at gcc dot gnu.org
2020-03-16 22:00 ` 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).