From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by sourceware.org (Postfix) with ESMTPS id ADC643858D20 for ; Fri, 11 Aug 2023 16:55:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADC643858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-56c96982829so1729682eaf.0 for ; Fri, 11 Aug 2023 09:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691772955; x=1692377755; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EuanTG3G7qoT9iWlxJTbgsInah7SueLMENrzQCHuNRY=; b=T4loZ501FFH19NJbzjQoYqaP/dzk/d+sONh6K6/Wp5h8Eql50yvfgYK0iDzQ3mU9/z xou4SZHPwuVmgfCRxQIWVH/A+AtHFcATp2Up5SWCv2P+sO52STVkIFSU/5ioBvRyfhhu t6cYFc+k0Zh23wyXSBJptZaQewzKn0yke16APNAmlegwiiVB5w8F49XAbUhqAcz9eosC cSCebbLkpCFeiU44yr44VYBBhhgf48hNCrA3zJghPAeIWFIwedla/izUEy+RXZmkM+I4 MfAOAGqMYldqeFwpvH2JW1bgTRVvM2oMX1amCC7ya4nGhP1/3k0NIW7NzNdSafVZMPbW E3/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691772955; x=1692377755; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EuanTG3G7qoT9iWlxJTbgsInah7SueLMENrzQCHuNRY=; b=FqbS8WelX6x8ezgFuop6g0dGzn4rOjj20TfFafA3VW4ry1v9yws17eTcuWPzUbay7c fmJ1VHALLFRdXfkfIEsKT2DiV3nfoE2XB81jjrhvISTbcNiwRCqkCy2cu7sUCVinfplB RuA59DKJf6Y3JikY9hoEF015qN98QnM3FcqU3OKn1obtYy8VmB5c4YlGvMgSUSK0q5cL f8gh+0KoQILqtiyZPtKaHxAO9MNRBGOTNcWvXgw0NNzOEkZaHrRbGQ+ScK9qLofqzm7h BQtrNl5f/6iUluYxW8Z6y0PzgGLh+QlouEYI8TtwhjVZy/648tnE96CxeJS7vMR3AmGI SAFg== X-Gm-Message-State: AOJu0YzdubqQ+Tnwtz/In/yU7b5WgjbiqiAdDhoZQoUBjZX2Rgcm/PQk 6/A+LklkurvjF7rMJKoEgsqvw0Uc0eMNOuJAYe0= X-Google-Smtp-Source: AGHT+IFjXXuoPORkD+ixovLV4l+r6xiBs41DO/VowDEmMYuBULdgF75OsYEhIIMAWNyhHHkFAeJ2Snr1rE5GeO5EVPU= X-Received: by 2002:a05:6870:85d3:b0:1b0:3637:2bbe with SMTP id g19-20020a05687085d300b001b036372bbemr2455327oal.54.1691772954878; Fri, 11 Aug 2023 09:55:54 -0700 (PDT) MIME-Version: 1.0 References: <1302200217.1817.1691757297462.JavaMail.zimbra@intec.unl.edu.ar> In-Reply-To: From: Paul Richard Thomas Date: Fri, 11 Aug 2023 17:55:43 +0100 Message-ID: Subject: Re: beta gfortran 14.x.y (using -march=native and intrinsic repeat) gives a signal SIGILL To: Jerry D Cc: "Jorge D'Elia" , Gfortran List , "Jorge D'Elia" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I wonder why the development 14.0.0 doesn't exhibit this behaviour? Could you please rerun with the compile options -g -fdump-tree-original . The later should generate a file *.original with the content: void test () { character(kind=1) cc[1:32]; __builtin_memmove ((void *) &cc, (void *) &" "[1]{lb: 1 sz: 1}, 32); { struct __st_parameter_dt dt_parm.0; dt_parm.0.common.filename = &"test_repeat.f90"[1]{lb: 1 sz: 1}; dt_parm.0.common.line = 7; dt_parm.0.common.flags = 128; dt_parm.0.common.unit = 6; _gfortran_st_write (&dt_parm.0); { character(kind=1) str.1[38]; character(kind=1) str.2[41]; _gfortran_concat_string (38, (character(kind=1)[1:] *) &str.1, 6, &" cc : "[1]{lb: 1 sz: 1}, 32, &cc); _gfortran_concat_string (41, (character(kind=1)[1:] *) &str.2, 38, (character(kind=1)[1:] *) &str.1, 3, &"end"[1]{lb: 1 sz: 1}); _gfortran_transfer_character_write (&dt_parm.0, (character(kind=1)[1:] *) &str.2, 41); } _gfortran_st_write_done (&dt_parm.0); } } Note that repeat is reduced to the builtin memmove with 32 spaces going to cc. Regards Paul On Fri, 11 Aug 2023 at 17:21, Jerry D via Fortran wrote: > > On 8/11/23 5:34 AM, Jorge D'Elia via Fortran wrote: > > Dear GFortran developers, > > > > With the beta gfortran 14.x.y versions we are noticing some runtime > > errors in a production code. > > > > One type of runtime errors is related to the concurrent use of the > > intrinsic "repeat" when the source code is compiled with the > > flag -march=native, please, see below: > > > > $ cat test.f90 > > program test > > implicit none > > integer , parameter :: iin = kind (1) > > integer (iin), parameter :: pp = 32 > > character (len=pp) :: cc > > cc (1:pp) = repeat (" ",pp) > > write (*,*)" cc : " // cc > > end program test > > > > $ gfortran --version > > GNU Fortran (GCC) 14.0.0 20230808 (experimental) > > Copyright (C) 2023 Free Software Foundation, Inc. > > This is free software; see the source for copying conditions. There is NO > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > > > a) Compiling with the flag -mtune=native only, without -march=native, the test is ok: > > > > $ gfortran -mtune=native -fcheck=all -std=f2018 -Wall -Werror -Wextra -Og -o test.exe test.f90 > > $ test.exe > > cc : > > > > b) However, compiling with the flag -march=native: > > > > $ gfortran -march=native -fcheck=all -std=f2018 -Wall -Werror -Wextra -Og -o test.exe test.f90 > > $ test.exe > > > > Program received signal SIGILL: Illegal instruction. > > > > Backtrace for this error: > > #0 0x14fae277fb1f in ??? > > #1 0x4011ad in ??? > > #2 0x401272 in ??? > > #3 0x14fae276a50f in ??? > > #4 0x14fae276a5c8 in ??? > > #5 0x4010c4 in ??? > > #6 0xffffffffffffffff in ??? > > Illegal instruction (core dumped) > > > > On the other hand, compiling with the system version (GNU Fortran (GCC) > > 12.3.1 20230508 (Red Hat 12.3.1-1)) or replacing the intrinsic repeat > > with: > > > > do kk = 1, pp > > cc (kk:kk) = " " > > end do > > > > both tests are ok. The error occurs on any of Intel or AMD computers, > > e.g. in the present case: > > > > $ lscpu > > Architecture: x86_64 > > CPU op-mode(s): 32-bit, 64-bit > > Address sizes: 46 bits physical, 48 bits virtual > > Byte Order: Little Endian > > CPU(s): 6 > > On-line CPU(s) list: 0-5 > > Vendor ID: GenuineIntel > > Model name: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz > > CPU family: 6 > > Model: 45 > > Thread(s) per core: 1 > > Core(s) per socket: 6 > > Socket(s): 1 > > Stepping: 7 > > BogoMIPS: 6400.22 > > Caches (sum of all): > > L1d: 192 KiB (6 instances) > > L1i: 192 KiB (6 instances) > > L2: 1.5 MiB (6 instances) > > L3: 12 MiB (1 instance) > > NUMA: > > NUMA node(s): 1 > > NUMA node0 CPU(s): 0-5 > > > > > > By the way, I do not know if the -march=native flag or the intrinsic > > repeat would be of deprecated use (or not)... > > Regardless, we should never segfault. Thanks for the code example. We > need to get a bug report opened on this. I am on travel this morning, > but if I have time i will do so this afternnon if someone else does not > beat me to it. > > There were some recent patches in this area IIRC. > > Jerry >