public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429
@ 2021-05-27  1:28 cnsun at uwaterloo dot ca
  2021-05-27  3:19 ` [Bug middle-end/100786] ICE: in fold_convert_loc with alias attribute and different types and different sizes pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-27  1:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100786
           Summary: ICE: in fold_convert_loc, at fold-const.c:2429
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210526 (experimental) [master revision
:21638bbbf:1fd76b24306ed4df4cf9e797d900699ed59ce7f7] (GCC)

$ cat mutant.c
const double a = 0;
extern b __attribute__((alias("a")));
inc() { b++; }

$ gcc-trunk  mutant.c
mutant.c:2:8: warning: type defaults to ‘int’ in declaration of ‘b’
[-Wimplicit-int]
    2 | extern b __attribute__((alias("a")));
      |        ^
mutant.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | inc() { b++; }
      | ^~~
mutant.c: In function ‘inc’:
mutant.c:3:10: internal compiler error: in fold_convert_loc, at
fold-const.c:2429
    3 | inc() { b++; }
      |         ~^~
0x6bfba3 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/fold-const.c:2429
0xc085b7 fold_stmt_1
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimple-fold.c:6251
0xc3cbf2 gimplify_modify_expr
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:6000
0xc2c1f8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:13965
0xc2fb2a gimplify_stmt(tree_node**, gimple**)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:6883
0xc31ce6 gimplify_and_add(tree_node*, gimple**)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:492
0xc31ce6 internal_get_tmp_var
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:645
0xc2b777 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:14954
0xc2bf91 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:14720
0xc3ca07 gimplify_modify_expr
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:5824
0xc2c1f8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:13965
0xc2fb2a gimplify_stmt(tree_node**, gimple**)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:6883
0xc3035e gimplify_bind_expr
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:1424
0xc2c593 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:14166
0xc2fb2a gimplify_stmt(tree_node**, gimple**)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:6883
0xc31123 gimplify_body(tree_node*, bool)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:15210
0xc31571 gimplify_function_tree(tree_node*)
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/gimplify.c:15364
0xa842c7 cgraph_node::analyze()
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/cgraphunit.c:670
0xa871f1 analyze_functions
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xa87cc1 symbol_table::finalize_compilation_unit()
        /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/gcc/cgraphunit.c:2508
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] 10+ messages in thread

* [Bug middle-end/100786] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
@ 2021-05-27  3:19 ` pinskia at gcc dot gnu.org
  2021-12-10  2:52 ` [Bug middle-end/100786] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-27  3:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|tree-ssa                    |12.0
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=100509

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to PR 100509.

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

* [Bug middle-end/100786] [9/10/11/12 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
  2021-05-27  3:19 ` [Bug middle-end/100786] ICE: in fold_convert_loc with alias attribute and different types and different sizes pinskia at gcc dot gnu.org
@ 2021-12-10  2:52 ` pinskia at gcc dot gnu.org
  2022-01-20 13:29 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10  2:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-10
   Target Milestone|---                         |9.5
      Known to fail|                            |11.1.0, 4.9.0, 5.1.0
      Known to work|                            |4.7.1, 4.8.5
     Ever confirmed|0                           |1
            Summary|ICE: in fold_convert_loc    |[9/10/11/12 Regression]
                   |with alias attribute and    |ICE: in fold_convert_loc
                   |different types and         |with alias attribute and
                   |different sizes             |different types and
                   |                            |different sizes

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can also reproduce using the following code with the C++ front-end:
extern const double a = 0;
extern int b __attribute__((alias("a")));
int inc() { b++; }

Confirmed.  I think the alias should be rejected if the following is true:
(TREE_CODE (a) == FUNCTION_DECL) != (TREE_CODE (b) == FUNCTION_DECL)
|| (sizeof (a) != sizeof (b))

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

* [Bug middle-end/100786] [9/10/11/12 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
  2021-05-27  3:19 ` [Bug middle-end/100786] ICE: in fold_convert_loc with alias attribute and different types and different sizes pinskia at gcc dot gnu.org
  2021-12-10  2:52 ` [Bug middle-end/100786] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-20 13:29 ` rguenth at gcc dot gnu.org
  2022-01-20 15:50 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Priority|P3                          |P2

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Testing a patch.

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

* [Bug middle-end/100786] [9/10/11/12 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2022-01-20 13:29 ` rguenth at gcc dot gnu.org
@ 2022-01-20 15:50 ` cvs-commit at gcc dot gnu.org
  2022-01-20 15:51 ` [Bug middle-end/100786] [9/10/11 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-20 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5c12507f5d0bc080e4f346af99824e039236e61c

commit r12-6776-g5c12507f5d0bc080e4f346af99824e039236e61c
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 20 14:25:51 2022 +0100

    middle-end/100786 - constant folding from incompatible alias

    The following avoids us ICEing doing constant folding from variables
    with aliases of different types.  The issue appears both in
    folding and CCP and FRE can do more fancy stuff to still constant
    fold cases where the load is smaller than the initializer so
    defer it to there.

    2022-01-20  Richard Biener  <rguenther@suse.de>

            PR middle-end/100786
            * gimple-fold.cc (get_symbol_constant_value): Only return
            values of compatible type to the symbol.

            * gcc.dg/torture/pr100786.c: New testcase.

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

* [Bug middle-end/100786] [9/10/11 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2022-01-20 15:50 ` cvs-commit at gcc dot gnu.org
@ 2022-01-20 15:51 ` rguenth at gcc dot gnu.org
  2022-02-17  9:06 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20 15:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.0
            Summary|[9/10/11/12 Regression]     |[9/10/11 Regression] ICE:
                   |ICE: in fold_convert_loc    |in fold_convert_loc with
                   |with alias attribute and    |alias attribute and
                   |different types and         |different types and
                   |different sizes             |different sizes

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug middle-end/100786] [9/10/11 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
                   ` (4 preceding siblings ...)
  2022-01-20 15:51 ` [Bug middle-end/100786] [9/10/11 " rguenth at gcc dot gnu.org
@ 2022-02-17  9:06 ` cvs-commit at gcc dot gnu.org
  2022-04-21 12:52 ` [Bug middle-end/100786] [9/10 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-17  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:6525b9fb23ec442f32b1809a2b44c415c0910387

commit r11-9582-g6525b9fb23ec442f32b1809a2b44c415c0910387
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 20 14:25:51 2022 +0100

    middle-end/100786 - constant folding from incompatible alias

    The following avoids us ICEing doing constant folding from variables
    with aliases of different types.  The issue appears both in
    folding and CCP and FRE can do more fancy stuff to still constant
    fold cases where the load is smaller than the initializer so
    defer it to there.

    2022-01-20  Richard Biener  <rguenther@suse.de>

            PR middle-end/100786
            * gimple-fold.c (get_symbol_constant_value): Only return
            values of compatible type to the symbol.

            * gcc.dg/torture/pr100786.c: New testcase.

    (cherry picked from commit 5c12507f5d0bc080e4f346af99824e039236e61c)

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

* [Bug middle-end/100786] [9/10 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
                   ` (5 preceding siblings ...)
  2022-02-17  9:06 ` cvs-commit at gcc dot gnu.org
@ 2022-04-21 12:52 ` cvs-commit at gcc dot gnu.org
  2022-05-06 11:08 ` [Bug middle-end/100786] [9 " cvs-commit at gcc dot gnu.org
  2022-05-06 11:11 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-21 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:1e1b247774e0239f73b59e07f30db4e400f9b4eb

commit r10-10549-g1e1b247774e0239f73b59e07f30db4e400f9b4eb
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 20 14:25:51 2022 +0100

    middle-end/100786 - constant folding from incompatible alias

    The following avoids us ICEing doing constant folding from variables
    with aliases of different types.  The issue appears both in
    folding and CCP and FRE can do more fancy stuff to still constant
    fold cases where the load is smaller than the initializer so
    defer it to there.

    2022-01-20  Richard Biener  <rguenther@suse.de>

            PR middle-end/100786
            * gimple-fold.c (get_symbol_constant_value): Only return
            values of compatible type to the symbol.

            * gcc.dg/torture/pr100786.c: New testcase.

    (cherry picked from commit 5c12507f5d0bc080e4f346af99824e039236e61c)

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

* [Bug middle-end/100786] [9 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
                   ` (6 preceding siblings ...)
  2022-04-21 12:52 ` [Bug middle-end/100786] [9/10 " cvs-commit at gcc dot gnu.org
@ 2022-05-06 11:08 ` cvs-commit at gcc dot gnu.org
  2022-05-06 11:11 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-06 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

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

commit r9-10041-gfba3068ec155e4d9a3074d55d3c3b1111c0bcb84
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 20 14:25:51 2022 +0100

    middle-end/100786 - constant folding from incompatible alias

    The following avoids us ICEing doing constant folding from variables
    with aliases of different types.  The issue appears both in
    folding and CCP and FRE can do more fancy stuff to still constant
    fold cases where the load is smaller than the initializer so
    defer it to there.

    2022-01-20  Richard Biener  <rguenther@suse.de>

            PR middle-end/100786
            * gimple-fold.c (get_symbol_constant_value): Only return
            values of compatible type to the symbol.

            * gcc.dg/torture/pr100786.c: New testcase.

    (cherry picked from commit 5c12507f5d0bc080e4f346af99824e039236e61c)

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

* [Bug middle-end/100786] [9 Regression] ICE: in fold_convert_loc with alias attribute and different types and different sizes
  2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
                   ` (7 preceding siblings ...)
  2022-05-06 11:08 ` [Bug middle-end/100786] [9 " cvs-commit at gcc dot gnu.org
@ 2022-05-06 11:11 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-06 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |9.4.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |9.4.1

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-05-06 11:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  1:28 [Bug c/100786] New: ICE: in fold_convert_loc, at fold-const.c:2429 cnsun at uwaterloo dot ca
2021-05-27  3:19 ` [Bug middle-end/100786] ICE: in fold_convert_loc with alias attribute and different types and different sizes pinskia at gcc dot gnu.org
2021-12-10  2:52 ` [Bug middle-end/100786] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-20 13:29 ` rguenth at gcc dot gnu.org
2022-01-20 15:50 ` cvs-commit at gcc dot gnu.org
2022-01-20 15:51 ` [Bug middle-end/100786] [9/10/11 " rguenth at gcc dot gnu.org
2022-02-17  9:06 ` cvs-commit at gcc dot gnu.org
2022-04-21 12:52 ` [Bug middle-end/100786] [9/10 " cvs-commit at gcc dot gnu.org
2022-05-06 11:08 ` [Bug middle-end/100786] [9 " cvs-commit at gcc dot gnu.org
2022-05-06 11:11 ` rguenth 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).