Bug 82183 - gcc.dg/sancov/cmp0.c fails on aarch64
Summary: gcc.dg/sancov/cmp0.c fails on aarch64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: sanitizer (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 8.0
Assignee: Martin Liška
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-11 18:47 UTC by Steve Ellcey
Modified: 2018-02-19 18:31 UTC (History)
5 users (show)

See Also:
Host:
Target: aarch64,nvptx
Build:
Known to work:
Known to fail: 8.0
Last reconfirmed: 2017-09-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Ellcey 2017-09-11 18:47:48 UTC
The new test, gcc.dg/sancov/cmp0.c, is failing on aarch64.
The failures I get are:

FAIL: gcc.dg/sancov/cmp0.c   -O0   scan-tree-dump-times optimized "__builtin___s
anitizer_cov_trace_const_cmp" 7
FAIL: gcc.dg/sancov/cmp0.c   -O0   scan-tree-dump-times optimized "__builtin___s
anitizer_cov_trace_switch \\(" 2
FAIL: gcc.dg/sancov/cmp0.c   -O0 -g   scan-tree-dump-times optimized "__builtin_
__sanitizer_cov_trace_const_cmp" 7
FAIL: gcc.dg/sancov/cmp0.c   -O0 -g   scan-tree-dump-times optimized "__builtin_
__sanitizer_cov_trace_switch \\(" 2

When I look at the cmp0.c.229t.optimized file I see 23 calls to
__builtin___sanitizer_cov_trace_const_cmp[1248] and no calls to
__builtin___sanitizer_cov_trace_switch.  I think GCC on aarch64
turned the switch statement into a series of if's.

I am not sure if any other platforms are affected by this.
Comment 1 Martin Liška 2017-09-11 19:17:13 UTC
Yes, it must run before switchlower pass. I'm planning multiple changes to the pass, so I fix that.
Comment 2 Tom de Vries 2017-09-25 09:06:56 UTC
(In reply to Steve Ellcey from comment #0)
> I am not sure if any other platforms are affected by this.

nvptx as well:
...
FAIL: gcc.dg/sancov/cmp0.c   -O0   scan-tree-dump-times optimized "__builtin___sanitizer_cov_trace_const_cmp" 7
FAIL: gcc.dg/sancov/cmp0.c   -O0   scan-tree-dump-times optimized "__builtin___sanitizer_cov_trace_switch \\(" 2
FAIL: gcc.dg/sancov/cmp0.c   -O0 -g   scan-tree-dump-times optimized "__builtin___sanitizer_cov_trace_const_cmp" 7
FAIL: gcc.dg/sancov/cmp0.c   -O0 -g   scan-tree-dump-times optimized "__builtin___sanitizer_cov_trace_switch \\(" 2
...
Comment 3 Martin Liška 2018-02-19 18:31:07 UTC
Author: marxin
Date: Mon Feb 19 18:30:31 2018
New Revision: 257817

URL: https://gcc.gnu.org/viewcvs?rev=257817&root=gcc&view=rev
Log:
Put pass_sancov_O0 before pass_lower_switch with -O0 (PR sanitizer/82183).

2018-02-19  Martin Liska  <mliska@suse.cz>

	PR sanitizer/82183
	* passes.def: Put pass_sancov_O0 before pass_lower_switch with -O0.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/passes.def
Comment 4 Martin Liška 2018-02-19 18:31:50 UTC
Fixed.