Message ID | 20211031195059.1542754-1-rep.dot.nop@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E3C83858022 for <patchwork@sourceware.org>; Sun, 31 Oct 2021 19:51:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E3C83858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635709914; bh=JU/3rmU85Rv0lxyf+neYfq1k7zsds/GU8o1+3b6rMQI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=WY022glcN6f3Z3LwYs26vru6thMxF65QowuTrDv9F1mAmhnJWrsriXnMW76c0wqq1 QUiCdwVWchg3O8RhmA8YAnMKuxzHC6occR5RxDT13hUhVF18jYzifV86sUS65Mv/Hf B0ziRBPlAmuF3E1no0eSS1JIg5cKx52Dk3+jW/yo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 7DE913858420; Sun, 31 Oct 2021 19:51:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7DE913858420 Received: by mail-wm1-x336.google.com with SMTP id 67-20020a1c1946000000b0030d4c90fa87so10490025wmz.2; Sun, 31 Oct 2021 12:51:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JU/3rmU85Rv0lxyf+neYfq1k7zsds/GU8o1+3b6rMQI=; b=GCNInF0ZL3zPbFmhO0EcfX1Ra6StF7Kx+HHXSQUTDXxzVlUpQzP/IKVKRhqLTc1mzM XMZ89adFxOgYLImEd5qr6L+qZS2cK5ZGO2lGDvFz18c6v4v6BdFle4syJXpdQaZ+2U/B AuaK+b++jFGYsfcgcuQjFs3SdoylQPxbgQ0u/WCxJlxBneYEHaY0TfYEQrhy8g3IdSWS hoxoXFi/v+ki4gEwHnFTuMtsuiwvAkQItNjuojRN0X1mM8rQi+JDvJXVQ4IZKRTFHRK5 4C4g7+1tR7D4hmQqv/7aYkWxfCQfH1xKnUFMr4UsGaunjuTKy292sG6Usbztkru4U9HF ZUdQ== X-Gm-Message-State: AOAM531Ss+SK2MLpLBNy/cUwJfV58QYUUh4stresaiPUiKD0IeVPS7kZ m4LejUb+nSMj+gTgaG7LoDA= X-Google-Smtp-Source: ABdhPJz7+we36SU/7I1s0jEUvyHyjX/XPgjhMXmLhilSCuZChO2ecoZIQhIc8fgOGL1e74ZO6ASHOQ== X-Received: by 2002:a1c:2b04:: with SMTP id r4mr35908762wmr.48.1635709867541; Sun, 31 Oct 2021 12:51:07 -0700 (PDT) Received: from nbbrfq.weghof (dynamic-2bq7di4u2lfl4qjka9-pd01.res.v6.highway.a1.net. [2001:871:227:33a8:f6a3:c58c:7641:e771]) by smtp.gmail.com with ESMTPSA id m34sm10021976wms.25.2021.10.31.12.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 12:51:07 -0700 (PDT) Received: from b by nbbrfq.weghof with local (Exim 4.95) (envelope-from <b@localhost>) id 1mhGrC-006TLM-9t; Sun, 31 Oct 2021 20:51:06 +0100 To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org, Sandra Loosemore <sandra@codesourcery.com> Subject: [PATCH] Fortran: Diagnose all operands with constraint violations [PR101337] Date: Sun, 31 Oct 2021 20:50:59 +0100 Message-Id: <20211031195059.1542754-1-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Bernhard Reutner-Fischer via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Cc: Bernhard Reutner-Fischer <aldot@gcc.gnu.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Fortran: Diagnose all operands with constraint violations [PR101337]
|
|
Commit Message
Bernhard Reutner-Fischer
Oct. 31, 2021, 7:50 p.m. UTC
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
PR fortran/101337
gcc/fortran/ChangeLog:
* resolve.c (resolve_operator): Continue resolving on op2 error.
---
The PR rightfully notes that we only diagnose the right operator
and do not check the left operator if the right one was faulty.
c407b-2 is one of the testcases with respective XFAILs.
Since that testcase is rather big (and full of errors) i'm listing an
abbreviated version here, including the output we'd generate with the
attached patch.
Note: I did not address the XFAILs! Sandra, please take over if you like
the patch!
Bootstrapped and regtested without new regressions (XFAILs are
apparently ignored and not flagged if they are auto-fixed).
As said, Sandra please take over, i'm deleting this locally.
$ cat c407b-2-b.f90;echo EOF; gfortran -c c407b-2-b.f90
subroutine s2 (x, y)
implicit none
type(*) :: x, y
integer :: i
! relational operations
if (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
.eq. y) then ! { dg-error "Assumed.type" }
return
end if
if (.not. (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
.ne. y)) then ! { dg-error "Assumed.type" }
return
end if
i = (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
+ y) ! { dg-error "Assumed.type" }
end subroutine
EOF
c407b-2-b.f90:8:10:
8 | .eq. y) then ! { dg-error "Assumed.type" }
| 1
Error: Assumed-type variable y at (1) may only be used as actual argument
c407b-2-b.f90:7:6:
7 | if (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
| 1
Error: Assumed-type variable x at (1) may only be used as actual argument
c407b-2-b.f90:12:17:
12 | .ne. y)) then ! { dg-error "Assumed.type" }
| 1
Error: Assumed-type variable y at (1) may only be used as actual argument
c407b-2-b.f90:11:13:
11 | if (.not. (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
| 1
Error: Assumed-type variable x at (1) may only be used as actual argument
c407b-2-b.f90:16:10:
16 | + y) ! { dg-error "Assumed.type" }
| 1
Error: Assumed-type variable y at (1) may only be used as actual argument
c407b-2-b.f90:15:7:
15 | i = (x & ! { dg-error "Assumed.type" "pr101337, failure to diagnose both operands" { xfail *-*-*} }
| 1
Error: Assumed-type variable x at (1) may only be used as actual argument
---
gcc/fortran/resolve.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On 10/31/21 1:50 PM, Bernhard Reutner-Fischer wrote: > From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org> > > PR fortran/101337 > > gcc/fortran/ChangeLog: > > * resolve.c (resolve_operator): Continue resolving on op2 error. > > --- > The PR rightfully notes that we only diagnose the right operator > and do not check the left operator if the right one was faulty. > > c407b-2 is one of the testcases with respective XFAILs. > Since that testcase is rather big (and full of errors) i'm listing an > abbreviated version here, including the output we'd generate with the > attached patch. > > Note: I did not address the XFAILs! Sandra, please take over if you like > the patch! > > Bootstrapped and regtested without new regressions (XFAILs are > apparently ignored and not flagged if they are auto-fixed). > As said, Sandra please take over, i'm deleting this locally. OK, I will take a look at the test results once I reach a good stopping point with the other thing I am hacking at present. -Sandra
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1f4abd08720..705d2326a29 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -4064,7 +4064,7 @@ resolve_operator (gfc_expr *e) { default: if (!gfc_resolve_expr (e->value.op.op2)) - return false; + t = false; /* Fall through. */ @@ -4091,6 +4091,9 @@ resolve_operator (gfc_expr *e) op2 = e->value.op.op2; if (op1 == NULL && op2 == NULL) return false; + /* Error out if op2 did not resolve. We already diagnosed op1. */ + if (t == false) + return false; dual_locus_error = false;