From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 11E993858426 for ; Fri, 11 Aug 2023 16:21:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11E993858426 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-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6873f64a290so492697b3a.0 for ; Fri, 11 Aug 2023 09:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691770906; x=1692375706; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sZAdjqDAjKUn3sTzoZ1HI6BTXBSf28sBmPS6KxCwyPU=; b=k7geWUMigQUTVyWKgBNhP/aetK+fZvk3KvQstLZMrILJx0Cxo9joTWXxjJvO2AMxBz ksoiHuwwo6VwdrM1WhVte3RLPA8T0kJjybH7OoW2lq8978N04/aQ7UB8nA6NDYxq3Xnl 8Rf3pB9KebV7Xv7hRifk5deW2DtPCADzM/aMv1JjZ85McdsgcqPkCtWfEDkoQD3rBHSn cggyDPDNve0wEtltxTu8oLmXqBr6s5L+gvsU5vT05XhaEbsjwH5KoU09xQSoVQKVmAbX mHp+uc9XSQYLjqUG8UvozkZLMvFTRozyJoRfJNgYP//7NXdhvoLOgNW1KJRWdRQNpbDL x88g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691770906; x=1692375706; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sZAdjqDAjKUn3sTzoZ1HI6BTXBSf28sBmPS6KxCwyPU=; b=KdEoQ/G48rtjnxoc6+Ca2hs9povoXIvcUFUpJafekehtrTDuJPYuzZw0KSLCtDQ9AW 4KnrVJf1XVZ+pDku41dDNE6v4qPfYx3UlQZRYzqCVl+xGw95F5iVDOytR6WOqc18d8ll eXlWl3nvMgACD2ZLIh0vaR08GS4KAIlRbg/+qaM5oz5nRo16Jev5iO3tEe00vykRKN+k Jv4GeWfllXOMyiR+zYy78i+fgCqbztQmOEhYXWd8MdiqU6JUrE675c0xpZA+Uxm7C1Aq ehpk18g9L025bgQIG6GHXknMVzpQXY4atSRmWCEV6ALwWm6c4pKKxD/HzdMFT8BeDR/q Z8Yg== X-Gm-Message-State: AOJu0YwDHMrwksJhpDlbfxLZsmdYJUbDTWE/TJGJ73O9KmjQmJK+Lo0u vLRgZABipwWnNyue97Sh+CYwD4P3+G4= X-Google-Smtp-Source: AGHT+IGJzyjSueiJIJAiAvs4YVZ3m3orQ7NVhgEGeEKQIHanHuIPC61nn9Q8Bkj/3G2EfAl0FWwvjQ== X-Received: by 2002:a17:902:c94b:b0:1b8:aded:524c with SMTP id i11-20020a170902c94b00b001b8aded524cmr2738902pla.1.1691770905861; Fri, 11 Aug 2023 09:21:45 -0700 (PDT) Received: from [192.168.1.20] ([50.37.188.226]) by smtp.gmail.com with ESMTPSA id n12-20020a1709026a8c00b001b8b6a19bd6sm4109728plk.63.2023.08.11.09.21.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Aug 2023 09:21:45 -0700 (PDT) Message-ID: Date: Fri, 11 Aug 2023 09:21:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: beta gfortran 14.x.y (using -march=native and intrinsic repeat) gives a signal SIGILL Content-Language: en-US To: Jorge D'Elia , Gfortran List Cc: Jorge D'Elia References: <1302200217.1817.1691757297462.JavaMail.zimbra@intec.unl.edu.ar> From: Jerry D In-Reply-To: <1302200217.1817.1691757297462.JavaMail.zimbra@intec.unl.edu.ar> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A,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: 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