public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100595] New: ICE: output_operand: invalid expression as operand
@ 2021-05-14 5:59 cnsun at uwaterloo dot ca
2021-05-14 7:21 ` [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label marxin at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-14 5:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100595
Bug ID: 100595
Summary: ICE: output_operand: invalid expression as operand
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.eZIsobWkq2-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 20210514 (experimental) [master revision
:e5c3c8afa:f3b1516d9dfd969d7cc1ca6f26dec13478a1c458] (GCC)
$ cat mutant.c
typedef __UINTPTR_TYPE__ uintptr_t;
test2() {
static uintptr_t a = &&l1 + ((char *)&&l1 - (char *)&&l2);
l1:
l2:
return a;
}
$ gcc-trunk mutant.c
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | test2() {
| ^~~~~
mutant.c: In function ‘test2’:
mutant.c:3:24: warning: initialization of ‘uintptr_t’ {aka ‘long unsigned int’}
from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
3 | static uintptr_t a = &&l1 + ((char *)&&l1 - (char *)&&l2);
| ^~
mutant.c: At top level:
mutant.c:7:1: internal compiler error: output_operand: invalid expression as
operand
7 | }
| ^
0xb7f867 output_operand_lossage(char const*, ...)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/final.c:3238
0xb80341 output_addr_const(_IO_FILE*, rtx_def*)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/final.c:3835
0xb80123 output_addr_const(_IO_FILE*, rtx_def*)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/final.c:3810
0x1240c82 assemble_integer_with_op(char const*, rtx_def*)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2866
0x1240ce1 default_assemble_integer(rtx_def*, unsigned int, int)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2882
0x1240d60 assemble_integer(rtx_def*, unsigned int, unsigned int, int)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2898
0x1247cc8 output_constant
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:5267
0x1249f74 output_constant
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:5172
0x1249f74 assemble_variable_contents
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2235
0x1253cfc assemble_variable(tree_node*, int, int, int)
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2414
0x1256dc9 varpool_node::assemble_decl()
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varpool.c:595
0xa80549 output_in_order
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2135
0xa80549 symbol_table::compile()
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2353
0xa8365b symbol_table::compile()
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2269
0xa8365b symbol_table::finalize_compilation_unit()
/tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2537
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] 6+ messages in thread
* [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label
2021-05-14 5:59 [Bug c/100595] New: ICE: output_operand: invalid expression as operand cnsun at uwaterloo dot ca
@ 2021-05-14 7:21 ` marxin at gcc dot gnu.org
2021-05-17 12:16 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-05-14 7:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100595
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-05-14
Status|UNCONFIRMED |NEW
CC| |jsm28 at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Is it really a valid C code?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label
2021-05-14 5:59 [Bug c/100595] New: ICE: output_operand: invalid expression as operand cnsun at uwaterloo dot ca
2021-05-14 7:21 ` [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label marxin at gcc dot gnu.org
@ 2021-05-17 12:16 ` rguenth at gcc dot gnu.org
2021-05-17 20:54 ` joseph at codesourcery dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-17 12:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100595
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's using a GNU extension, but we likely shouldn't accept it as a valid
constant initializer.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label
2021-05-14 5:59 [Bug c/100595] New: ICE: output_operand: invalid expression as operand cnsun at uwaterloo dot ca
2021-05-14 7:21 ` [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label marxin at gcc dot gnu.org
2021-05-17 12:16 ` rguenth at gcc dot gnu.org
@ 2021-05-17 20:54 ` joseph at codesourcery dot com
2024-04-07 5:29 ` pinskia at gcc dot gnu.org
2024-04-07 5:32 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2021-05-17 20:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100595
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
My old model of constant expressions for GNU extensions says that the
difference of two label addresses is a "label difference constant
expression", which is valid as a static initializer by itself but not when
added to anything.
https://www.polyomino.org.uk/computer/c/const-exprs-gnu.txt
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label
2021-05-14 5:59 [Bug c/100595] New: ICE: output_operand: invalid expression as operand cnsun at uwaterloo dot ca
` (2 preceding siblings ...)
2021-05-17 20:54 ` joseph at codesourcery dot com
@ 2024-04-07 5:29 ` pinskia at gcc dot gnu.org
2024-04-07 5:32 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-07 5:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100595
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Updated testcase:
```
typedef __UINTPTR_TYPE__ uintptr_t;
int test2() {
static uintptr_t a = (uintptr_t)(&&l1 + ((char *)&&l1 - (char *)&&l2));
l1:
l2:
return (int)a;
}
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label
2021-05-14 5:59 [Bug c/100595] New: ICE: output_operand: invalid expression as operand cnsun at uwaterloo dot ca
` (3 preceding siblings ...)
2024-04-07 5:29 ` pinskia at gcc dot gnu.org
@ 2024-04-07 5:32 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-07 5:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100595
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |141242068 at smail dot nju.edu.cn
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 112499 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-07 5:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 5:59 [Bug c/100595] New: ICE: output_operand: invalid expression as operand cnsun at uwaterloo dot ca
2021-05-14 7:21 ` [Bug middle-end/100595] ICE: output_operand with static const int of address of label + difference of label marxin at gcc dot gnu.org
2021-05-17 12:16 ` rguenth at gcc dot gnu.org
2021-05-17 20:54 ` joseph at codesourcery dot com
2024-04-07 5:29 ` pinskia at gcc dot gnu.org
2024-04-07 5:32 ` pinskia 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).