Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1322692 Details for
Bug 1488993
No warning when generating incorrect code due to undefined behaviour in loop iteration
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
foo.cpp
foo.cpp (text/x-csrc), 1.33 KB, created by
Paulo Andrade
on 2017-09-06 14:51:38 UTC
(
hide
)
Description:
foo.cpp
Filename:
MIME Type:
Creator:
Paulo Andrade
Created:
2017-09-06 14:51:38 UTC
Size:
1.33 KB
patch
obsolete
>// This example exposes an optimizer bug in GCC on RHEL 7.2, >// g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4). >// >// When compiled with >// >// g++ --std=c++11 -O2 -S foo.cpp >// >// the generated code for the loop is as expected: >// >// .L4: >// leaq 15(%rsp), %rdi >// movl %ebx, %esi >// addl $1, %ebx >// call Derived::fun(int) const >// cmpl %ebp, %eax >// je .L2 >// call zonk() >// .L2: >// addl $286331153, %ebp >// cmpl $8, %ebx >// jne .L4 >// >// When compiled with >// >// g++ --std=c++11 -O2 -DBUG -S foo.cpp >// >// the loop condition disappears, making the loop infinite: >// >// .L5: >// movl %ebx, %esi >// movq %rsp, %rdi >// .LEHB1: >// call Derived::fun(int) const >// addl $1, %ebx >// cmpl %ebp, %eax >// je .L7 >// call zonk() >// .LEHE1: >// .L7: >// addl $286331153, %ebp >// jmp .L5 INFINITE LOOP > >class Base >{ >public: >#ifdef BUG > virtual ~Base(void); >#endif >}; > >class Derived : public Base >{ >public: > int fun(int) const; >}; > >extern Derived oink(void); >extern void zonk(void); > >void >foo(void) >{ > Derived rsp = oink(); > > for (int i = 0; i < 8; ++i) { > if (rsp.fun(i) != (0x11111111 * (i+1))) { > zonk(); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1488993
: 1322692