On Wed, Jan 18, 2017 at 10:53:59AM +0100, Martin Liška wrote:
> As I've been reading when the warning is emitted (rtl expansion), I guess a
> pair of function was merged
> by IPA ICF and thus the location points to a different function.
>
> I can't reproduce the test-case due to missing __HTM__. Can you please
> provide pre-processed source file?
The testcase doesn't include any headers, just compile it with a cross to
s390x-linux. That said, IMHO the test should either use -fno-ipa-icf,
or use something to avoid ICFing of functions it doesn't want to fold
(say use int return type instead of void and return a different constant in
each case).
I think the testcase as written just assumes ICF happens but in a certain
way and what broke is that the same functions are ICFed in a different order
now, because with -fno-ipa-icf it reports:
tattr-2.c: In function ‘p0’:
tattr-2.c:23:3: error: Builtin ‘__builtin_tend’ is not supported without -mhtm
(default with -march=zEC12 and higher).
__builtin_tend ();
^~~~~~~~~~~~~~~~~
tattr-2.c: In function ‘a0’:
tattr-2.c:42:3: error: Builtin ‘__builtin_tend’ is not supported without -mhtm
(default with -march=zEC12 and higher).
__builtin_tend (); /* { dg-error "is not supported without -mhtm" } */
^~~~~~~~~~~~~~~~~
tattr-2.c: In function ‘htmd’:
tattr-2.c:50:3: error: Builtin ‘__builtin_tend’ is not supported without -mhtm
(default with -march=zEC12 and higher).
__builtin_tend (); /* { dg-error "is not supported without -mhtm" } */
^~~~~~~~~~~~~~~~~
So my preference is to add -fno-ipa-icf to dg-options and
add the missing dg-error line on line 42.
Like below, ok for trunk?
2017-01-18 Jakub Jelinek <[email protected]>
* gcc.target/s390/target-attribute/tattr-2.c: Add -fno-ipa-icf
to dg-options.
(p0): Add missing dg-error.
--- gcc/testsuite/gcc.target/s390/target-attribute/tattr-2.c.jj 2015-12-04
17:19:09.000000000 +0100
+++ gcc/testsuite/gcc.target/s390/target-attribute/tattr-2.c 2017-01-18
11:18:15.674196392 +0100
@@ -2,7 +2,7 @@
/* { dg-do compile */
/* { dg-require-effective-target target_attribute } */
-/* { dg-options "-O3 -march=zEC12 -mno-htm" } */
+/* { dg-options "-O3 -march=zEC12 -mno-htm -fno-ipa-icf" } */
#pragma GCC target("htm")
void p1(void)
@@ -20,7 +20,7 @@ void p0(void)
#ifdef __HTM__
#error __HTM__ is defined
#endif
- __builtin_tend ();
+ __builtin_tend (); /* { dg-error "is not supported without -mhtm" } */
}
#pragma GCC reset_options
Jakub