public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu
@ 2020-11-15 9:49 zhendong.su at inf dot ethz.ch
2020-11-15 12:53 ` [Bug rtl-optimization/97836] " zhendong.su at inf dot ethz.ch
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2020-11-15 9:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Bug ID: 97836
Summary: wrong code at -O1 on x86_64-pc-linux-gnu
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
[510] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201115 (experimental) [master revision
406b452dc0e:d88ff5a679d:faab61b585a8b4a42454f085dd6b7815992a98f5] (GCC)
[511] %
[511] % gcctk -O0 small.c; ./a.out
[512] %
[512] % gcctk -O1 small.c; ./a.out
Aborted
[513] %
[513] % cat small.c
int *a, b;
int *f(int *c) {
b = 0;
return c;
}
int main() {
int d;
a = f(&d);
if (a != &d)
__builtin_abort ();
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
@ 2020-11-15 12:53 ` zhendong.su at inf dot ethz.ch
2020-11-15 13:19 ` [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029 hjl.tools at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2020-11-15 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another related test that triggers the miscompilation at -Os, but not -O1:
[621] % gcctk -O1 small.c; ./a.out
[622] %
[622] % gcctk -Os small.c; ./a.out
Aborted
[623] %
[623] % cat small.c
int a;
int b(int c) { return 0; }
static int *d(int *e) {
if (a) {
a = a && b(*e);
}
return e;
}
int main() {
int f;
if (d(&f) != &f)
__builtin_abort();
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
2020-11-15 12:53 ` [Bug rtl-optimization/97836] " zhendong.su at inf dot ethz.ch
@ 2020-11-15 13:19 ` hjl.tools at gmail dot com
2020-11-15 13:33 ` hubicka at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hjl.tools at gmail dot com @ 2020-11-15 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|wrong code at -O1 on |[11 Regression] wrong code
|x86_64-pc-linux-gnu |at -O1 on
| |x86_64-pc-linux-gnu by
| |r11-5029
Ever confirmed|0 |1
CC| |hjl.tools at gmail dot com,
| |jh at suse dot cz
Target Milestone|--- |11.0
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-11-15
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
It is caused by r11-5029
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
2020-11-15 12:53 ` [Bug rtl-optimization/97836] " zhendong.su at inf dot ethz.ch
2020-11-15 13:19 ` [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029 hjl.tools at gmail dot com
@ 2020-11-15 13:33 ` hubicka at gcc dot gnu.org
2020-11-16 7:26 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2020-11-15 13:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |hubicka at gcc dot gnu.org
--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Confirmed.
The wrong code happens already in fre1 where we do:
main ()
{
int f;
int * _1;
<bb 2> :
_1 = d (&f);
__builtin_abort ();
}
Modref summary for d is:
loads:
Limits: 32 bases, 16 refs
Base 0: alias set 1
Ref 0: alias set 1
Every access
stores:
Limits: 32 bases, 16 refs
Base 0: alias set 1
Ref 0: alias set 1
Every access
parm 0 flags: direct noclobber noescape unused
for body:
d (int * e)
{
int D.1973;
int a.0_1;
<bb 2> :
a.0_1 = a;
if (a.0_1 != 0)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
a = 0;
<bb 4> :
return e_10(D);
}
direct noclobber noescape looks correct to me: value is only returned and
noescape values are allowed to escape to return value (per IRC discussion we
had with Richi).
I think problem is with unused that makes tree-ssa-structalias to completely
skip the parameter rather than adding it to return value alias set.
I guess we want to specify what unused really means. Indeed current comment is
"Nonzero if the argument is not used by the function." and in this case we wold
need to have separate EAF_NOREAD so current EAF_UNUSED would be EAF_NOCLOBBER |
EAF_NOREAD or track that internally in ipa-modref.
A quick fix is to make return statement clear EAF_UNUSED flag.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (2 preceding siblings ...)
2020-11-15 13:33 ` hubicka at gcc dot gnu.org
@ 2020-11-16 7:26 ` rguenth at gcc dot gnu.org
2020-11-16 7:46 ` hubicka at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-16 7:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Priority|P3 |P1
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Indeed EAF_UNUSED was supposed to be really unused (which includes not escaping
anywhere, including to the return). I guess we could change it to allow
escaping to return in case fully unused isn't useful. Nothing used EAF_UNUSED
I think and I just added it for completeness back in time...
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (3 preceding siblings ...)
2020-11-16 7:26 ` rguenth at gcc dot gnu.org
@ 2020-11-16 7:46 ` hubicka at gcc dot gnu.org
2020-12-02 19:31 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2020-11-16 7:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I forgot to attach the PR number, but I commited the quick fix (to prevent
wrong code) as g:26285af40f98dfdb809b98b08386073c63b65db1
I will discuss the EAF_UNUSED flag today after teaching.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (4 preceding siblings ...)
2020-11-16 7:46 ` hubicka at gcc dot gnu.org
@ 2020-12-02 19:31 ` jakub at gcc dot gnu.org
2021-01-01 19:11 ` [Bug rtl-optimization/97836] " hubicka at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-12-02 19:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, can this be closed as fixed or do you want to do something further?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (5 preceding siblings ...)
2020-12-02 19:31 ` jakub at gcc dot gnu.org
@ 2021-01-01 19:11 ` hubicka at gcc dot gnu.org
2021-03-29 10:21 ` hubicka at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-01-01 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11 Regression] wrong code |wrong code at -O1 on
|at -O1 on |x86_64-pc-linux-gnu by
|x86_64-pc-linux-gnu by |r11-5029
|r11-5029 |
--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
It is no longer regression, I will look into defining EAF_UNUSED better next
stage1.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (6 preceding siblings ...)
2021-01-01 19:11 ` [Bug rtl-optimization/97836] " hubicka at gcc dot gnu.org
@ 2021-03-29 10:21 ` hubicka at gcc dot gnu.org
2021-04-27 11:39 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-03-29 10:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
indeed, I think for gcc11 we want to make return mark value as used and for
next stage1 we want to design EAF flags bit more carefully...
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (7 preceding siblings ...)
2021-03-29 10:21 ` hubicka at gcc dot gnu.org
@ 2021-04-27 11:39 ` jakub at gcc dot gnu.org
2021-07-28 7:05 ` rguenth at gcc dot gnu.org
2021-08-22 19:40 ` hubicka at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.0 |11.2
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (8 preceding siblings ...)
2021-04-27 11:39 ` jakub at gcc dot gnu.org
@ 2021-07-28 7:05 ` rguenth at gcc dot gnu.org
2021-08-22 19:40 ` hubicka at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28 7:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |11.3
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
` (9 preceding siblings ...)
2021-07-28 7:05 ` rguenth at gcc dot gnu.org
@ 2021-08-22 19:40 ` hubicka at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-08-22 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #11 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
EAF_UNUSED is now realy unused.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-08-22 19:40 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 9:49 [Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu zhendong.su at inf dot ethz.ch
2020-11-15 12:53 ` [Bug rtl-optimization/97836] " zhendong.su at inf dot ethz.ch
2020-11-15 13:19 ` [Bug rtl-optimization/97836] [11 Regression] wrong code at -O1 on x86_64-pc-linux-gnu by r11-5029 hjl.tools at gmail dot com
2020-11-15 13:33 ` hubicka at gcc dot gnu.org
2020-11-16 7:26 ` rguenth at gcc dot gnu.org
2020-11-16 7:46 ` hubicka at gcc dot gnu.org
2020-12-02 19:31 ` jakub at gcc dot gnu.org
2021-01-01 19:11 ` [Bug rtl-optimization/97836] " hubicka at gcc dot gnu.org
2021-03-29 10:21 ` hubicka at gcc dot gnu.org
2021-04-27 11:39 ` jakub at gcc dot gnu.org
2021-07-28 7:05 ` rguenth at gcc dot gnu.org
2021-08-22 19:40 ` hubicka 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).