Bug 53272 - wrong condition-codes for strict-low-part destination and small-integer source
Summary: wrong condition-codes for strict-low-part destination and small-integer source
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.7
: P3 normal
Target Milestone: 4.7.2
Assignee: Hans-Peter Nilsson
URL:
Keywords: wrong-code
Depends on:
Blocks: 53273
  Show dependency treegraph
 
Reported: 2012-05-08 00:00 UTC by Hans-Peter Nilsson
Modified: 2012-05-08 15:37 UTC (History)
0 users

See Also:
Host: x86_64-unknown-linux-gnu
Target: crisv32-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-05-08 00:00:00


Attachments
testcase to be compiled with -O2 (285 bytes, text/plain)
2012-05-08 00:11 UTC, Hans-Peter Nilsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Nilsson 2012-05-08 00:00:09 UTC
Bug spotted on the 4.7 branch, exposed by the test-case as far back as the 4.4 branch r186831.  Test-case to be attached, need a PR number.
Comment 1 Hans-Peter Nilsson 2012-05-08 00:11:03 UTC
Created attachment 27337 [details]
testcase to be compiled with -O2

The effect of the bug is to eliminate the NULL-pointer check for rtc->ops->f and always call it, which is not a good idea when it is NULL.  Test-case derived from a Linux driver.

Unfortunately, presence of a main function makes the bug hide by slightly changing the generated code, so I have to put the framework in a separate file to make a runnable test-case. This is a secondary bug, for which I will clone a PR from this PR: with the marker-asms and attributes noclone, noinline, there should be no need for that.  It seems static branch predictions change.
Comment 2 Hans-Peter Nilsson 2012-05-08 15:20:56 UTC
Author: hp
Date: Tue May  8 15:20:52 2012
New Revision: 187283

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187283
Log:
	PR target/53272
	* config/cris/cris.c (cris_normal_notice_update_cc): For TARGET_V32,
	when a constant source operand matches an "I" constraint, the "no
	CC0 change" applies to a register-destination only, not a
	strict_low_part-destination.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/cris/cris.c
Comment 3 Hans-Peter Nilsson 2012-05-08 15:21:55 UTC
Author: hp
Date: Tue May  8 15:21:50 2012
New Revision: 187284

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187284
Log:
	PR target/53272
	* gcc.dg/torture/pr53272-1.c, gcc.dg/torture/pr53272-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr53272-1.c
    trunk/gcc/testsuite/gcc.dg/torture/pr53272-2.c
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 4 Hans-Peter Nilsson 2012-05-08 15:27:08 UTC
Author: hp
Date: Tue May  8 15:27:03 2012
New Revision: 187285

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187285
Log:
	PR target/53272
	* config/cris/cris.c (cris_normal_notice_update_cc): For TARGET_V32,
	when a constant source operand matches an "I" constraint, the "no
	CC0 change" applies to a register-destination only, not a
	strict_low_part-destination.

Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/cris/cris.c
Comment 5 Hans-Peter Nilsson 2012-05-08 15:28:02 UTC
Author: hp
Date: Tue May  8 15:27:58 2012
New Revision: 187286

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187286
Log:
	PR target/53272
	* gcc.dg/torture/pr53272-1.c, gcc.dg/torture/pr53272-2.c: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr53272-1.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr53272-2.c
Modified:
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Comment 6 Hans-Peter Nilsson 2012-05-08 15:35:20 UTC
target-bug fixed, no further backports intended.
Comment 7 Hans-Peter Nilsson 2012-05-08 15:37:20 UTC
oops, have to actually change to "resolved, fixed" too.