Bug 88682 - new test case c-c++-common/pr51628-10.c fails starting with its introduction in r267313
Summary: new test case c-c++-common/pr51628-10.c fails starting with its introduction ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2019-01-03 20:15 UTC by seurer
Modified: 2022-02-04 08:15 UTC (History)
5 users (show)

See Also:
Host: powerpc64*-unknown-linux-gnu
Target: powerpc64*-unknown-linux-gnu aarch64
Build: powerpc64*-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2019-01-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description seurer 2019-01-03 20:15:51 UTC
make -k check-gcc RUNTESTFLAGS=dg.exp=c-c++-common/pr51628-10.c

FAIL: c-c++-common/pr51628-10.c  -Wc++-compat  execution test
FAIL: c-c++-common/pr51628-10.c  -std=gnu++98 execution test
FAIL: c-c++-common/pr51628-10.c  -std=gnu++14 execution test
FAIL: c-c++-common/pr51628-10.c  -std=gnu++17 execution test


# of expected passes		1
# of expected passes		3
# of unexpected failures	1
# of unexpected failures	3

The test case is exiting with a non-zero return code when it fails.
Comment 1 H.J. Lu 2019-01-03 20:21:52 UTC
It looks like that powerpc64 failed to properly handle packed __int128_t.
Comment 2 H.J. Lu 2019-01-03 20:25:55 UTC
aarch64 may have the same issue.
Comment 3 Christophe Lyon 2019-01-03 21:19:17 UTC
Indeed, the test also fails on aarch64-linux-gnu
Comment 4 Martin Sebor 2019-01-13 00:28:58 UTC
Confirmed based on the latest test results for both targets:
https://gcc.gnu.org/ml/gcc-testresults/2019-01/msg01230.html
https://gcc.gnu.org/ml/gcc-testresults/2019-01/msg01245.html
Comment 5 Steve Ellcey 2019-01-14 17:54:24 UTC
It looks like this test is violating strict aliasing.  If I compile with
-fno-strict-aliasing then it works.

I think pointing p.i (type __int128_t) to something of type unaligned_int128_t
is a standards violation in C or C++ but I am not a language lawyer.

FYI: I get the same behavior with C or C++ on aarch64.  It works with -O1
on aarch64 but fails with -O2 and the difference is the ordering of loads
and stores.
Comment 6 Andrew Pinski 2019-01-15 03:23:49 UTC
Yes this does violate aliasing rules.  Easy fix is to add may_alias to the attributes of unaligned_int128_t.
Comment 7 Jakub Jelinek 2019-01-15 08:19:00 UTC
Patch to do so is preapproved.
Comment 8 Jakub Jelinek 2019-01-16 14:19:18 UTC
Author: jakub
Date: Wed Jan 16 14:18:47 2019
New Revision: 267970

URL: https://gcc.gnu.org/viewcvs?rev=267970&root=gcc&view=rev
Log:
	PR c/51628
	PR target/88682
	* c-c++-common/pr51628-10.c (unaligned_int128_t): Add
	may_alias attribute.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/pr51628-10.c
Comment 9 Jakub Jelinek 2019-01-16 14:29:13 UTC
Fixed.