]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Improve unlimited_polymorphic_3.f03 [PR103662]
authorJakub Jelinek <jakub@redhat.com>
Tue, 26 Apr 2022 07:17:32 +0000 (09:17 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 26 Apr 2022 07:17:32 +0000 (09:17 +0200)
On Mon, Apr 25, 2022 at 01:38:25PM +0200, Mikael Morin wrote:
> I have just pushed the attached fix for two UNRESOLVED checks at -O0 that I
> hadn’t seen.

I don't like forcing of DSE in -O0 compilation, wouldn't it be better
to just not check the dse dump at -O0 like in the following patch?

Even better would be to check that the z._data = stores are both present
in *.optimized dump, but that doesn't really work at -O2 or above because
we inline the functions and optimize it completely away (both the stores
and corresponding reads).

The first hunk is needed so that __OPTIMIZE__ effective target works in
Fortran testsuite, otherwise one gets a pedantic error and __OPTIMIZE__
is considered not to match at all.

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR fortran/103662
* lib/target-supports.exp (check_effective_target___OPTIMIZE__): Add
a var definition to avoid pedwarn about empty translation unit.
* gfortran.dg/unlimited_polymorphic_3.f03: Remove -ftree-dse from
dg-additional-options, guard scan-tree-dump-not directives on
__OPTIMIZE__ target.

gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03
gcc/testsuite/lib/target-supports.exp

index 4104de6ac68c53fb880d158da963dd04291c6032..00dd2ae119960d5c500904df70c05cb7361e9877 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-do run }
-! { dg-additional-options "-ftree-dse -fdump-tree-dse-details" }
+! { dg-additional-options "-fdump-tree-dse-details" }
 !
 ! Check that pointer assignments allowed by F2003:C717
 ! work and check null initialization of CLASS(*) pointers.
@@ -71,5 +71,5 @@ end subroutine foo_sq
 ! We used to produce multiple independant types for the unlimited polymorphic
 ! descriptors (types for class(*)) which caused stores to them to be seen as
 ! useless.
-! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &w" "dse1" } }
-! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &x" "dse1" } }
+! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &w" "dse1" { target __OPTIMIZE__ } } }
+! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &x" "dse1" { target __OPTIMIZE__ } } }
index 8bdb4a845f54c3b39a270d5279a7f50aef6d0f36..902bdae8a441b55949c32713d510bfd70a74a14e 100644 (file)
@@ -11770,6 +11770,8 @@ proc check_effective_target___OPTIMIZE__ {} {
        #ifndef __OPTIMIZE__
        # error nein
        #endif
+       /* Avoid pedwarn about empty TU.  */
+       int dummy;
     } [current_compiler_flags]]
 }