public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/113215] New: gimple FE can't handle static local variable with initializer
@ 2024-01-03 11:49 acoplan at gcc dot gnu.org
2024-01-08 14:43 ` [Bug c/113215] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: acoplan at gcc dot gnu.org @ 2024-01-03 11:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113215
Bug ID: 113215
Summary: gimple FE can't handle static local variable with
initializer
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
The following testcase is accepted:
int __GIMPLE (ssa)
f ()
{
static int x;
__BB(2):
return 1;
}
but adding an initializer to the static variable, it gets rejected:
$ cat > t.c
int __GIMPLE (ssa)
f ()
{
static int x = 1;
__BB(2):
return 1;
}
$ gcc/xgcc -B gcc -c -fgimple t.c
t.c: In function ‘f’:
t.c:4:18: error: expected ‘;’ before ‘=’ token
4 | static int x = 1;
| ^
t.c: At top level:
t.c:5:10: error: expected declaration specifiers or ‘...’ before numeric
constant
5 | __BB(2):
| ^
t.c:7:1: error: expected identifier or ‘(’ before ‘}’ token
7 | }
| ^
such IL can be generated by dumping optimized GIMPLE as seen e.g. with the
following testcase:
$ cat t2.c
int f() {
static int x = 1;
return x;
}
$ gcc/xgcc -B gcc -c t2.c -fdump-tree-optimized-gimple=-
int __GIMPLE (ssa)
f ()
{
static int x = 1;
int D_4434;
int _2;
__BB(2):
_2 = x;
goto __BB3;
__BB(3):
L0:
return _2;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/113215] gimple FE can't handle static local variable with initializer
2024-01-03 11:49 [Bug middle-end/113215] New: gimple FE can't handle static local variable with initializer acoplan at gcc dot gnu.org
@ 2024-01-08 14:43 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-08 14:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113215
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-01-08
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-08 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 11:49 [Bug middle-end/113215] New: gimple FE can't handle static local variable with initializer acoplan at gcc dot gnu.org
2024-01-08 14:43 ` [Bug c/113215] " 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).