From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) by sourceware.org (Postfix) with ESMTPS id A5F393864877 for ; Sat, 6 Feb 2021 16:59:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A5F393864877 Received: from zm-mta-out.u-ga.fr (zm-mta-out.u-ga.fr [152.77.200.53]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 7063941510; Sat, 6 Feb 2021 17:59:02 +0100 (CET) Received: from smtps.univ-grenoble-alpes.fr (smtps1.u-ga.fr [152.77.1.30]) by zm-mta-out.u-ga.fr (Postfix) with ESMTP id 6A74C801BA; Sat, 6 Feb 2021 17:59:02 +0100 (CET) Received: from localhost.localdomain (82-64-214-7.subs.proxad.net [82.64.214.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: begoup@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id 52D32187E0F; Sat, 6 Feb 2021 17:59:02 +0100 (CET) To: fortran@gcc.gnu.org From: Patrick Begou Subject: gfortran 10.2 and tests in debug mode Message-ID: <3961ac8d-17d1-8391-25e0-a54ee51f4089@univ-grenoble-alpes.fr> Date: Sat, 6 Feb 2021 17:59:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 Content-Language: en-US X-Greylist: Whitelist-UGA SMTP Authentifie (begoup@univ-grenoble-alpes.fr) via submission-587 ACL (110) X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2021 16:59:15 -0000 Hi, this is my first post on this list. I have a strange behavior with gfortran 10.2 freshly deployed.  This small test-case program below give a segfault in debug mode only with gfortran 10.2 and not with 7.3, 6.3.0 or 4.8.5. In the real life, the do_it could be a parameter received in a function saying "if 0 do nothing else do something every do_it timestep". In my mind, if the first condition in the if line is false, the second one must not be evaluated. But with gfortran 10.2 it is. program badtest    implicit none    integer:: i,do_it=0    do i=1,4       if (do_it > 0 .and. mod(i,do_it) .eq.0) then          print*, "Do it!"       else          print*, "No!"       endif    enddo end program badtest Compilation with: *gfortran -O0 -Wall -g  -ffree-line-length-none -fbacktrace -ffpe-trap=zero,overflow -finit-real=nan -fcheck=all badtest.F90 -o badtest* I've split all such tests in 2 consecutives "if" lines in my code to allow debuging but not sure it is the right behavior in Fortran. Patrick