From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 571C23858C74 for ; Fri, 26 Jan 2024 13:44:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 571C23858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 571C23858C74 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706276684; cv=none; b=yDRjDRMz5bQr1tjvjhjXAKPF/mOlzYUtHdH+RER1DCH760a1UPxwOGyiNER3+BY/NqFHT6ldl7s6SG/B45rpsUJ6CwEgR0G4Iea9wc3Pcm4HuydgQ3nfvTg7Wm03VAID/R88ByU3g6cjy2Ba6jG57+Z8oN2wKNhLEGH9hfujNIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706276684; c=relaxed/simple; bh=oGQGRUd/k9OOfchbvbhkbjFUZklZ1TNaj8SMHNktwxQ=; h=DKIM-Signature:From:Mime-Version:Subject:Message-Id:Date:To; b=naWzfVjva+tO7xlikNx0oClufLm2EcSNAz6QAekIx0n/2R85KJXh7xhNSm6lB3P1xFeqFeGr8pk9BUUKsHT2UITQwLIbfQMY3l1X2prr0WyjWI1Z/FtzwgQMtjQOZAExDwodYxLH33kAeKPTEjaFtTVJfdoze9L2W/ETGLZN2vU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2cf161b5eadso3691771fa.2 for ; Fri, 26 Jan 2024 05:44:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706276679; x=1706881479; darn=gcc.gnu.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=T7vuPUmEyxnfwO552iFTGveN5sxkCqiXzQkqFQoZSjY=; b=etCJmar0CRbWNC48SDkFNDlYwLF0mT955jU/E7E72lciQa6AKSQF7vuckHo0jxuesb QL5xvuUioNM89OeNf9qeUy+ETFM92DNuy8ECwpW/R9p278sxD42GY/b5W5nitXvkEdvw r+vT0PBA4tjakQfwKxlC4LXhPh2KjaTE9mehgWyQaRCmcAVT6RbqgF5jmkMFbFxOY2ib XGE3K067S2wQxstfPamhgbgZTPLX/UD9NFggSn2VZmen1vA67+ZCu0xhW1/vLxw98nAB tmmyKuQO4dZ6rWIQ/VfX/9G60JIRe927fVm2S1zz+3Sk/K+3Mx4KL1T3o5Ve5XB/1TKW Rffw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706276679; x=1706881479; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T7vuPUmEyxnfwO552iFTGveN5sxkCqiXzQkqFQoZSjY=; b=QfTvpbuJx4tketGZIjszoH0s/Mm2xaTjvk/42BYNuANbD/lk2Eza80T5hQ98nD6pFI 1UgMJ9cr67SkvJ0uhL5Mcy7iyR3Fn3bIqWokTYgEEOIc5GOPdhh9HGCh/XCCS4sq0qa2 N3CoKVvatwmrz+/4K2prg33Vfb4K1h3EeL2/laMz9iQHng4E49D3vAr3uWiZKzF1q2o3 MEKYXSGfgmxLMGMacGpmUKSlEZ6q3WrAQwbIKK07p0y/hwhdpuqCJVdxSYXFAqr+5eH0 F0yEw1c34umKvf40dCOnJgtvqV/ngumFtKMjZMV4Nb6/cXslVXAhKHX7gdRLvu0XwolU aQpg== X-Gm-Message-State: AOJu0YwtTy1bodmabtbh6tUG0Y8xZZ7Ainda4/bJOuJqV5nVN0t1s/Ux t7APshe75q3mFjJUBtZpYWV/lq3tkrEFWEL4Q/rGNV67Uxco9b170xKVqnik X-Google-Smtp-Source: AGHT+IGIUWm9tHnXZY1WUAJ+3jOj4eSobRUBGUhnAADWHZOea27ahSojLfEtLC4QMLwt5BDh+/QG3Q== X-Received: by 2002:a2e:b6d0:0:b0:2cc:f5b6:91ed with SMTP id m16-20020a2eb6d0000000b002ccf5b691edmr1464885ljo.23.1706276678698; Fri, 26 Jan 2024 05:44:38 -0800 (PST) Received: from smtpclient.apple ([2001:999:584:794e:f892:dfda:39b0:757d]) by smtp.gmail.com with ESMTPSA id v2-20020a2e9602000000b002ce098d3f0asm161106ljh.115.2024.01.26.05.44.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2024 05:44:38 -0800 (PST) From: Elias Toivanen Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Request to improve docs: Fortran integer ranges vs. machine representation Message-Id: <7268CB80-0A78-4A6B-AF8A-8B2211F28C0A@gmail.com> Date: Fri, 26 Jan 2024 15:44:26 +0200 To: fortran@gcc.gnu.org X-Mailer: Apple Mail (2.3731.700.6) X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Hi, I stumbled upon a Fortran quirk regarding the ranges for integers. The = standard stipulates that the ranges be symmetric even though as we know = two's complement signed integers have asymmetrical ranges, e.g. int8 = kind can vary between -128 and 127. This is sure to cause confusion as for example the following program = does not compile: ``` program main use iso_fortran_env implicit none print *, -128_int8 end program ``` GFortran 13.2.0 provides the error message Error: Integer too big for its kind at (1). This check can be disabled = with the option '-fno-range-check' =20 While a workaround to disable the range check is provided, the error = message is a bit misleading. For one, the number is too small for the = int8 number model. For the second, it is not obvious to the lay why = removing the kind literal leads to a clean compile. Codewise the topic has been discussed in PRs 13490 and 17912, and I = think the current implementation is correct. What could be improved are = the pages https://gcc.gnu.org/bugs/ and the above error message.=20 I would like to propose that the error message should hint more towards = the root cause. Something along the lines of: 'Out of range integer for = its selected kind at (1). This check can be disabled with the option = '-fno-range-check'. Secondly, I think this quirk could be a good candidate to the known bugs = section of your website. I tried to file a bug / craft a PR but access to your repos is a bit = limited at this point, so I decided to write this message as my 2 cents.=20= Anyway, thanks for your good work! I can also volunteer to help you with = this or some other tasks. Haven't done it before but would be = interesting to try it out. -- Best regards / Yst=C3=A4v=C3=A4llisesti Elias Toivanen elias.a.toivanen@gmail.com