public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules
@ 2021-04-07 9:29 acoplan at gcc dot gnu.org
2021-04-07 10:42 ` [Bug c/99955] " rguenth at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-07 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99955
Bug ID: 99955
Summary: gcc.c-torture/execute/pr92618.c violates strict
aliasing rules
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: testsuite
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
The above execution test trips the strict aliasing warnings:
aarch64-linux-gnu-gcc -O2 -Wall gcc/testsuite/gcc.c-torture/execute/pr92618.c
-static
gcc/testsuite/gcc.c-torture/execute/pr92618.c: In function ‘baz’:
gcc/testsuite/gcc.c-torture/execute/pr92618.c:44:4: warning: dereferencing
type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
44 | *(__m128i *) &a[0] = c;
| ^~~~~~~~~~~~~~~~~
gcc/testsuite/gcc.c-torture/execute/pr92618.c:45:4: warning: dereferencing
type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
45 | *(__m128i *) &a[2] = d;
| ^~~~~~~~~~~~~~~~~
but it doesn't set -fno-strict-aliasing. It looks like the test should set
-fno-strict-aliasing.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/99955] gcc.c-torture/execute/pr92618.c violates strict aliasing rules
2021-04-07 9:29 [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules acoplan at gcc dot gnu.org
@ 2021-04-07 10:42 ` rguenth at gcc dot gnu.org
2021-04-07 11:23 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-07 10:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99955
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |diagnostic, wrong-code
Ever confirmed|0 |1
CC| |jsm28 at gcc dot gnu.org
Component|testsuite |c
Last reconfirmed| |2021-04-07
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It is
typedef long long __m128i __attribute__((__may_alias__, __vector_size__(2 *
sizeof (long long))));
so should be OK unless the FE somehow magically screws up. And it looks
like it does!? The may-alias attribute isn't added to the built vector type
(but vector type building is a bit iffy).
It works when doing
typedef long long __m128i __attribute__((__vector_size__(2 * sizeof (long
long)), __may_alias__));
instead. Maybe we want to diagnose when the vector_size attribute isn't the
first attribute? Maybe we want to handle all this gracefully anyway?
Joseph?
Meanwhile Alex, it's pre-approved to adjust the testcase to make __may_alias__
come last ...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/99955] gcc.c-torture/execute/pr92618.c violates strict aliasing rules
2021-04-07 9:29 [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules acoplan at gcc dot gnu.org
2021-04-07 10:42 ` [Bug c/99955] " rguenth at gcc dot gnu.org
@ 2021-04-07 11:23 ` cvs-commit at gcc dot gnu.org
2021-04-07 11:24 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-07 11:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99955
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:0d6ad10c170e3670f0b5e3709e0fa6e76b7065b3
commit r11-8026-g0d6ad10c170e3670f0b5e3709e0fa6e76b7065b3
Author: Richard Biener <rguenther@suse.de>
Date: Wed Apr 7 13:21:23 2021 +0200
testsuite/99955 - fix may_alias declaration of vector
This fixes the order of the type attributes to preserve may_alias
for the vector type.
2021-04-07 Richard Biener <rguenther@suse.de>
PR testsuite/99955
* gcc.c-torture/execute/pr92618.c: Move may_alias attributes
last.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/99955] gcc.c-torture/execute/pr92618.c violates strict aliasing rules
2021-04-07 9:29 [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules acoplan at gcc dot gnu.org
2021-04-07 10:42 ` [Bug c/99955] " rguenth at gcc dot gnu.org
2021-04-07 11:23 ` cvs-commit at gcc dot gnu.org
@ 2021-04-07 11:24 ` rguenth at gcc dot gnu.org
2021-04-07 17:19 ` joseph at codesourcery dot com
2021-12-12 6:25 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-07 11:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99955
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I fixed the testcase - we should still diagnose the type declaration or make it
DTRT.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/99955] gcc.c-torture/execute/pr92618.c violates strict aliasing rules
2021-04-07 9:29 [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules acoplan at gcc dot gnu.org
` (2 preceding siblings ...)
2021-04-07 11:24 ` rguenth at gcc dot gnu.org
@ 2021-04-07 17:19 ` joseph at codesourcery dot com
2021-12-12 6:25 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2021-04-07 17:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99955
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I think may_alias ought to work together with vector_size, whatever its
position in the attribute list, i.e. there is a front-end bug here for
which making that combination of attributes work properly together in any
order is the right fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/99955] gcc.c-torture/execute/pr92618.c violates strict aliasing rules
2021-04-07 9:29 [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules acoplan at gcc dot gnu.org
` (3 preceding siblings ...)
2021-04-07 17:19 ` joseph at codesourcery dot com
@ 2021-12-12 6:25 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-12 6:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99955
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
handle_vector_size_attribute does:
/* Build back pointers if needed. */
tree new_type = build_vector_type (type, nunits);
/* Build back pointers if needed. */
*node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
But the default reconstruct_complex_type never reapplies the attributes back on
it. (I Have not looked into the c++ front-end's implementation to about the
same).
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-12 6:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 9:29 [Bug testsuite/99955] New: gcc.c-torture/execute/pr92618.c violates strict aliasing rules acoplan at gcc dot gnu.org
2021-04-07 10:42 ` [Bug c/99955] " rguenth at gcc dot gnu.org
2021-04-07 11:23 ` cvs-commit at gcc dot gnu.org
2021-04-07 11:24 ` rguenth at gcc dot gnu.org
2021-04-07 17:19 ` joseph at codesourcery dot com
2021-12-12 6:25 ` pinskia 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).