public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64689] New: tree-vectorize generates wrong code with inlined function - minimum working example included
@ 2015-01-20 13:32 philipp.gschwandtner at uibk dot ac.at
2015-01-20 14:10 ` [Bug tree-optimization/64689] " trippels at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: philipp.gschwandtner at uibk dot ac.at @ 2015-01-20 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64689
Bug ID: 64689
Summary: tree-vectorize generates wrong code with inlined
function - minimum working example included
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: philipp.gschwandtner at uibk dot ac.at
Created attachment 34500
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34500&action=edit
minimum working example
The tree vectorizer in gcc 4.7-4.9 appears to generate semantically incorrect
code for the particular case clarified in the attached minimum working example.
gcc 4.6.3 does not show this issue. In gcc 4.7.3 only one of the checks fails,
in gcc 4.8.3 and 4.9.2 both of them fail (as these versions also seem to
recognize case A as vectorizable).
Testing was performed on an Intel Xeon E5-2699 v3 Haswell CPU running a
3.10.0-123.13.1.el7.x86_64 Linux kernel.
Compile with:
gcc test.c -o test -O3 -std=c99 -pedantic -Wall -Wextra -fwrapv
-fno-strict-aliasing
Expected output (equals gcc 4.6.3 output):
Checking case A:
EQUAL!
Checking case B:
EQUAL!
Actual output (for gcc 4.8.3 and 4.9.2):
Checking case A:
NOT EQUAL!
C1:
-2 0i, -2 0i, -2 0i, -2 0i,
-2 0i, -2 0i, -2 0i, -2 0i,
-2 0i, -2 0i, -2 0i, -2 0i,
-2 0i, -2 0i, -2 0i, -2 0i,
C2:
-1 0i, -1 0i, -1 0i, -1 0i,
-1 0i, -1 0i, -1 0i, -1 0i,
-1 0i, -1 0i, -1 0i, -1 0i,
-1 0i, -1 0i, -1 0i, -1 0i,
Checking case B:
NOT EQUAL!
C1:
-2 0i, -2 0i, -2 0i, -2 0i,
-2 0i, -2 0i, -2 0i, -2 0i,
-2 0i, -2 0i, -2 0i, -2 0i,
-2 0i, -2 0i, -2 0i, -2 0i,
C2:
-1 0i, -1 0i, -1 0i, -1 0i,
-1 0i, -1 0i, -1 0i, -1 0i,
-1 0i, -1 0i, -1 0i, -1 0i,
-1 0i, -1 0i, -1 0i, -1 0i,
Above output is produced when compiled with gcc 4.9.2 and 4.8.3. For gcc 4.7.3
the check for case A succeeds while the check for case B still fails.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/64689] tree-vectorize generates wrong code with inlined function - minimum working example included
2015-01-20 13:32 [Bug tree-optimization/64689] New: tree-vectorize generates wrong code with inlined function - minimum working example included philipp.gschwandtner at uibk dot ac.at
@ 2015-01-20 14:10 ` trippels at gcc dot gnu.org
2015-01-21 9:33 ` philipp.gschwandtner at uibk dot ac.at
2015-01-21 9:38 ` trippels at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-01-20 14:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64689
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |trippels at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Compile with gcc-5 and use -fsanitize=undefined:
markus@x4 tmp % gcc -fsanitize=undefined test.c -o test -O3 -std=c99 -pedantic
-Wall -Wextra -fwrapv -fno-strict-aliasing
markus@x4 tmp % ./test
test.c:67:21: runtime error: shift exponent -4 is negative
test.c:68:21: runtime error: shift exponent -4 is negative
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/64689] tree-vectorize generates wrong code with inlined function - minimum working example included
2015-01-20 13:32 [Bug tree-optimization/64689] New: tree-vectorize generates wrong code with inlined function - minimum working example included philipp.gschwandtner at uibk dot ac.at
2015-01-20 14:10 ` [Bug tree-optimization/64689] " trippels at gcc dot gnu.org
@ 2015-01-21 9:33 ` philipp.gschwandtner at uibk dot ac.at
2015-01-21 9:38 ` trippels at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: philipp.gschwandtner at uibk dot ac.at @ 2015-01-21 9:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64689
--- Comment #2 from Philipp Gschwandtner <philipp.gschwandtner at uibk dot ac.at> ---
Thanks for the quick reply, it's an excerpt from a larger code and I wasn't
aware that it's actually not C-compliant.
Maybe gcc bug submission guidelines should include compiling/running with
-fsanitize to check for issues like that.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/64689] tree-vectorize generates wrong code with inlined function - minimum working example included
2015-01-20 13:32 [Bug tree-optimization/64689] New: tree-vectorize generates wrong code with inlined function - minimum working example included philipp.gschwandtner at uibk dot ac.at
2015-01-20 14:10 ` [Bug tree-optimization/64689] " trippels at gcc dot gnu.org
2015-01-21 9:33 ` philipp.gschwandtner at uibk dot ac.at
@ 2015-01-21 9:38 ` trippels at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-01-21 9:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64689
--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Philipp Gschwandtner from comment #2)
> Thanks for the quick reply, it's an excerpt from a larger code and I wasn't
> aware that it's actually not C-compliant.
>
> Maybe gcc bug submission guidelines should include compiling/running with
> -fsanitize to check for issues like that.
Yes, that is a good idea.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-21 9:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 13:32 [Bug tree-optimization/64689] New: tree-vectorize generates wrong code with inlined function - minimum working example included philipp.gschwandtner at uibk dot ac.at
2015-01-20 14:10 ` [Bug tree-optimization/64689] " trippels at gcc dot gnu.org
2015-01-21 9:33 ` philipp.gschwandtner at uibk dot ac.at
2015-01-21 9:38 ` trippels 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).