Bug 94706 - [8/9/10/11 Regression] class with empty base passed incorrectly with -std=c++17 on ia64
Summary: [8/9/10/11 Regression] class with empty base passed incorrectly with -std=c++...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 10.0
: P4 blocker
Target Milestone: 10.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ABI, wrong-code
Depends on: 94383
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-22 07:09 UTC by Jakub Jelinek
Modified: 2021-11-05 23:18 UTC (History)
10 users (show)

See Also:
Host:
Target: ia64-*-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Preprocessed t032_x.C with reduced t032_test.h (13.18 KB, text/plain)
2020-04-22 09:08 UTC, Andreas Schwab
Details
Preprocessed t032_y.C with reduced t032_test.h (14.41 KB, text/plain)
2020-04-22 09:09 UTC, Andreas Schwab
Details
Preprocessed t033_x.C with reduced t033_test.h (12.09 KB, text/plain)
2020-04-22 09:16 UTC, Andreas Schwab
Details
Preprocessed t033_y.C with reduced t033_test.h (12.41 KB, text/plain)
2020-04-22 09:16 UTC, Andreas Schwab
Details
Preprocessed t055_x.C with reduced t055_test.h (12.04 KB, text/plain)
2020-04-22 09:20 UTC, Andreas Schwab
Details
Preprocessed t055_y.C with reduced t055_test.h (12.28 KB, text/plain)
2020-04-22 09:21 UTC, Andreas Schwab
Details
Preprocessed t056_x.C with reduced t056_test.h (12.02 KB, text/plain)
2020-04-22 09:23 UTC, Andreas Schwab
Details
Preprocessed t056_y.C with reduced t056_test.h (12.31 KB, text/plain)
2020-04-22 09:24 UTC, Andreas Schwab
Details
Preprocessed t057_x.C with reduced t057_test.h (12.02 KB, text/plain)
2020-04-22 09:27 UTC, Andreas Schwab
Details
Preprocessed t057_y.C with reduced t057_test.h (12.31 KB, text/plain)
2020-04-22 09:27 UTC, Andreas Schwab
Details
Preprocessed t058_x.C with reduced t058_test.h (12.26 KB, text/plain)
2020-04-22 09:30 UTC, Andreas Schwab
Details
Preprocessed t058_y.C with reduced t058_test.h (12.68 KB, text/plain)
2020-04-22 09:30 UTC, Andreas Schwab
Details
Preprocessed t059_x.C with reduced t059_test.h (12.04 KB, text/plain)
2020-04-22 09:34 UTC, Andreas Schwab
Details
Preprocessed t059_y.C with reduced t059_test.h (12.28 KB, text/plain)
2020-04-22 09:35 UTC, Andreas Schwab
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2020-04-22 07:09:23 UTC
+++ This bug was initially created as a clone of Bug #94383 +++

In https://gcc.gnu.org/pipermail/gcc-testresults/2020-April/559430.html
I see
FAIL: tmpdir-g++.dg-struct-layout-1/t032 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t033 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t055 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t056 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t057 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t058 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t059 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
That suggests similar ABI bug as on aarch64 (PR94383), where the presence or absence of C++17 empty base artificial FIELD_DECL affects the argument passing (or return?).
One should be able to do
make check-g++ RUNTESTFLAGS='--target_board=unix/-DDBG struct-layout-1.exp'
to get more information into the log file which exact tests fail, from that number one can look up in gcc/testsuite/g++/g++.dg-struct-layout-1 subdir of the build directory t032_test.h etc. the T(...) line with the reported number(s),
and one should be able to remove all but the chosen one T(...) line from the file to see a minimized testcase (+ preprocess to better see how exactly the structure looks like).
Comment 1 Jakub Jelinek 2020-04-22 07:10:17 UTC
Andreas, do you think you could find out which struct (at least one) FAILs?  See above...
Comment 2 Andreas Schwab 2020-04-22 09:08:46 UTC
Created attachment 48336 [details]
Preprocessed t032_x.C with reduced t032_test.h

fail 116.55
fail 116.56
fail 116.30
fail 120.55
fail 142.55
fail 142.56
fail 142.30
fail 144.55
fail 144.56
fail 144.30
fail 145.55
fail 145.56
fail 145.30
fail 178.55
fail 178.56
fail 178.30
fail 187.10
fail 187.11
fail 187.12
fail 187.50
fail 187.55
fail 187.56
fail 187.18
fail 187.30
Comment 3 Andreas Schwab 2020-04-22 09:09:20 UTC
Created attachment 48337 [details]
Preprocessed t032_y.C with reduced t032_test.h
Comment 4 Andreas Schwab 2020-04-22 09:16:02 UTC
Created attachment 48338 [details]
Preprocessed t033_x.C with reduced t033_test.h

fail 545.55
Comment 5 Andreas Schwab 2020-04-22 09:16:30 UTC
Created attachment 48339 [details]
Preprocessed t033_y.C with reduced t033_test.h
Comment 6 Andreas Schwab 2020-04-22 09:20:43 UTC
Created attachment 48340 [details]
Preprocessed t055_x.C with reduced t055_test.h

fail 2006.55
fail 2006.56
fail 2006.30
Comment 7 Andreas Schwab 2020-04-22 09:21:09 UTC
Created attachment 48341 [details]
Preprocessed t055_y.C with reduced t055_test.h
Comment 8 Andreas Schwab 2020-04-22 09:23:58 UTC
Created attachment 48342 [details]
Preprocessed t056_x.C with reduced t056_test.h

fail 2215.55
fail 2215.56
fail 2215.30
Comment 9 Andreas Schwab 2020-04-22 09:24:27 UTC
Created attachment 48343 [details]
Preprocessed t056_y.C with reduced t056_test.h
Comment 10 Andreas Schwab 2020-04-22 09:27:12 UTC
Created attachment 48344 [details]
Preprocessed t057_x.C with reduced t057_test.h

fail 2411.55
fail 2411.56
fail 2411.30
Comment 11 Andreas Schwab 2020-04-22 09:27:40 UTC
Created attachment 48345 [details]
Preprocessed t057_y.C with reduced t057_test.h
Comment 12 Andreas Schwab 2020-04-22 09:30:20 UTC
Created attachment 48346 [details]
Preprocessed t058_x.C with reduced t058_test.h

fail 2613.30
fail 2638.30
Comment 13 Andreas Schwab 2020-04-22 09:30:51 UTC
Created attachment 48347 [details]
Preprocessed t058_y.C with reduced t058_test.h
Comment 14 Andreas Schwab 2020-04-22 09:34:51 UTC
Created attachment 48348 [details]
Preprocessed t059_x.C with reduced t059_test.h

fail 2854.30
Comment 15 Andreas Schwab 2020-04-22 09:35:17 UTC
Created attachment 48349 [details]
Preprocessed t059_y.C with reduced t059_test.h
Comment 16 Jakub Jelinek 2020-04-22 10:54:39 UTC
Would:
--- gcc/config/ia64/ia64.c.jj	2020-01-12 11:54:36.338414540 +0100
+++ gcc/config/ia64/ia64.c	2020-04-22 12:49:59.627563114 +0200
@@ -4665,7 +4665,7 @@ hfa_element_mode (const_tree type, bool
     case QUAL_UNION_TYPE:
       for (t = TYPE_FIELDS (type); t; t = DECL_CHAIN (t))
 	{
-	  if (TREE_CODE (t) != FIELD_DECL)
+	  if (TREE_CODE (t) != FIELD_DECL || cxx17_empty_base_field_p (t))
 	    continue;
 
 	  mode = hfa_element_mode (TREE_TYPE (t), 1);
on top of https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544276.html fix that?
ia64 doesn't have any -Wpsabi warnings, so I think it isn't worth bothering with that.
Comment 17 Andreas Schwab 2020-04-22 12:20:36 UTC
With that patch all struct-layout-1.exp tests pass.
Comment 18 GCC Commits 2020-04-22 14:48:39 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1be62528078aef241fef6d2fe1cbc8e8e5379115

commit r10-7882-g1be62528078aef241fef6d2fe1cbc8e8e5379115
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Apr 22 16:47:58 2020 +0200

    ia64: Fix C++14 vs. C++17 ABI issue on ia64 [PR94706]
    
    ia64 seems to be affected too, but the backend doesn't have any
    -Wpsabi warnings and I'm not sure if we really need them for an (almost?)
    dead target.
    
    2020-04-22  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/94706
            * config/ia64/ia64.c (hfa_element_mode): Ignore
            cxx17_empty_base_field_p fields.
Comment 19 GCC Commits 2020-04-29 07:08:13 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:cde4353e58410cef404df066a059cd548f702055

commit r10-8028-gcde4353e58410cef404df066a059cd548f702055
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Apr 29 09:07:30 2020 +0200

    ia64: Adjust the C++14 vs. C++17 ABI thing for [[no_unique_address]] too [PR94706]
    
    2020-04-29  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/94706
            * config/ia64/ia64.c (hfa_element_mode): Use DECL_FIELD_ABI_IGNORED
            instead of cxx17_empty_base_field_p.
Comment 20 Jakub Jelinek 2020-05-07 09:22:44 UTC
Fixed for 10.1+.
Comment 21 Tim Turner 2021-11-05 23:18:28 UTC Comment hidden (spam)