public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98159] New: Compiler generates infinite loop
@ 2020-12-06 6:15 olme8 at mail dot ru
2020-12-06 6:30 ` [Bug c/98159] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: olme8 at mail dot ru @ 2020-12-06 6:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98159
Bug ID: 98159
Summary: Compiler generates infinite loop
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: olme8 at mail dot ru
Target Milestone: ---
This code creates an infinite loop when compiled with -O2/-O3.
int main() {
int a=1;
for(;a+=a;);
return a;
}
The compiler doesn't think that integers have a finite number of bits.
But works with:
for(;a<<=1;);
Which does the same.
Checked GCC versions 7.5.0 and 10.2.0. Machine is x86/x86_64.
https://godbolt.org/z/4Tb9ds
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/98159] Compiler generates infinite loop
2020-12-06 6:15 [Bug c/98159] New: Compiler generates infinite loop olme8 at mail dot ru
@ 2020-12-06 6:30 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-12-06 6:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98159
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Signed interger overflow is undefined in C.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-06 6:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 6:15 [Bug c/98159] New: Compiler generates infinite loop olme8 at mail dot ru
2020-12-06 6:30 ` [Bug c/98159] " 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).