public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-8260] testsuite: Improve unlimited_polymorphic_3.f03 [PR103662]
Date: Tue, 26 Apr 2022 07:18:55 +0000 (GMT)	[thread overview]
Message-ID: <20220426071855.B598B3858D37@sourceware.org> (raw)

https://gcc.gnu.org/g:22c24ba48a20a4944a50cca06449debed7d1b3f4

commit r12-8260-g22c24ba48a20a4944a50cca06449debed7d1b3f4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 26 09:17:32 2022 +0200

    testsuite: Improve unlimited_polymorphic_3.f03 [PR103662]
    
    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.

Diff:
---
 gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 | 6 +++---
 gcc/testsuite/lib/target-supports.exp                 | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03
index 4104de6ac68..00dd2ae1199 100644
--- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03
@@ -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__ } } }
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 8bdb4a845f5..902bdae8a44 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11770,6 +11770,8 @@ proc check_effective_target___OPTIMIZE__ {} {
 	#ifndef __OPTIMIZE__
 	# error nein
 	#endif
+	/* Avoid pedwarn about empty TU.  */
+	int dummy;
     } [current_compiler_flags]]
 }


                 reply	other threads:[~2022-04-26  7:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220426071855.B598B3858D37@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).