RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1488993 - No warning when generating incorrect code due to undefined behaviour in loop iteration
Summary: No warning when generating incorrect code due to undefined behaviour in loop ...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gcc
Version: 7.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Marek Polacek
QA Contact: Michael Petlan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-06 14:51 UTC by Paulo Andrade
Modified: 2020-12-14 09:54 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-10-11 11:01:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
foo.cpp (1.33 KB, text/x-csrc)
2017-09-06 14:51 UTC, Paulo Andrade
no flags Details

Description Paulo Andrade 2017-09-06 14:51:38 UTC
Created attachment 1322692 [details]
foo.cpp

The issue is not generating any warning, and generating "expected"
result when declaring a virtual destructor.

  Customer was told that the issue would be fixed by declaring the
"i" variable as long (as unsigned would also work).

  gcc 7.1.1 shows a warning with -fno-tree-vrp that would be expected
to be also shown if tree-vrp is also enabled, thus the bug report:

$ g++ --std=c++11 -O2 -fno-tree-vrp  -S foo.cpp
foo.cpp: In function ‘void foo()’:
foo.cpp:66:35: warning: iteration 7 invokes undefined behavior [-Waggressive-loop-optimizations]
     if (rsp.fun(i) != (0x11111111 * (i+1))) {
                       ~~~~~~~~~~~~^~~~~~~~
foo.cpp:65:21: note: within this loop
   for (int i = 0; i < 8; ++i) {
                   ~~^~~

Comment 2 Jakub Jelinek 2017-09-06 15:04:47 UTC
The -Waggressive-loop-optimizations warning certainly doesn't have the goal to detect all possible UBs in loops, that is really impossible, it just handles some easy cases of loops with single exit that provably have to invoke a small set of UBs in one of the iterations.
I bet you don't get a warning here because zonk could throw an exception and therefore the loop has multiple exits and could never invoke the UB if the exception is thrown before the UB.
The customer should better use -fsanitize=undefined to look for some UB in the code at runtime and then to fix it.

Comment 3 Marek Polacek 2017-10-11 11:01:20 UTC
I don't think there's anything to do for RHEL7.5.


Note You need to log in before you can comment on or make changes to this bug.