{"id":2224711,"url":"http://patchwork.ozlabs.org/api/patches/2224711/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/2407579.ElGaqSPkdT@fomalhaut/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<2407579.ElGaqSPkdT@fomalhaut>","list_archive_url":null,"date":"2026-04-17T20:23:04","name":"[Ada] Fix internal error on decimal literal with huge exponent","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"20e92633e02e2e477ab635b977b201c8b5ebe14a","submitter":{"id":78832,"url":"http://patchwork.ozlabs.org/api/people/78832/?format=json","name":"Eric Botcazou","email":"botcazou@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/2407579.ElGaqSPkdT@fomalhaut/mbox/","series":[{"id":500401,"url":"http://patchwork.ozlabs.org/api/series/500401/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500401","date":"2026-04-17T20:23:04","name":"[Ada] Fix internal error on decimal literal with huge exponent","version":1,"mbox":"http://patchwork.ozlabs.org/series/500401/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224711/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224711/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=dmaTSl7t;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=dmaTSl7t","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=adacore.com","sourceware.org; spf=pass smtp.mailfrom=adacore.com","server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.49"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fy67Y2dcWz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 06:34:48 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 68CC44CCCA30\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 20:34:46 +0000 (GMT)","from mail-wm1-f49.google.com (mail-wm1-f49.google.com\n [209.85.128.49])\n by sourceware.org (Postfix) with ESMTPS id 0499E4C900E6\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 20:32:58 +0000 (GMT)","by mail-wm1-f49.google.com with SMTP id\n 5b1f17b1804b1-488afb0427eso13360655e9.1\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 13:32:57 -0700 (PDT)","from fomalhaut.localnet ([2a01:e0a:107c:2f10:e654:e8ff:fe8f:2ce6])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43fe4cb1249sm6091577f8f.5.2026.04.17.13.32.55\n for <gcc-patches@gcc.gnu.org>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 17 Apr 2026 13:32:55 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 68CC44CCCA30","OpenDKIM Filter v2.11.0 sourceware.org 0499E4C900E6"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 0499E4C900E6","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 0499E4C900E6","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776457978; cv=none;\n b=d0B/qIGQwB8FrmVyTlW3aAxVeXyschD2+I3t7779HISIiTIKQg7qwUPBOojRtMTWbDBeK1cwN8yKlp9+PD3X7Dx3k83tnN9kLePVfp1EAxdZQtrRJmF+0S9oFfZ/uKnR3RJJ124/qv93DYSXJ3g/HrPt0GYyX4XGzRlyFCAry7Q=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776457978; c=relaxed/simple;\n bh=aYkMGZ7I5ESrhxmgPLkdSBNPF9IGqy4uBeAw9ORCj5I=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=VE+XgPZN3NLXSoKlMgp5SPS77cWG0ZEbdk5ZWcHedhRz/QY09do8TtizSwMDbx7SMGC0XvY0ucne8hXnPquQV04FY04zZAAXPy221hXWXPMRjI+fe4qzGlYCXXZ8FUlbzNfnqKuQ6Tdj7oOGTlFwkAl8mlfdi6q8j2/XT3EhWsw=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=adacore.com; s=google; t=1776457977; x=1777062777; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:to\n :from:from:to:cc:subject:date:message-id:reply-to;\n bh=YelOjC68Uh1blaR8bkh9GTwV8k1cdQb2ozydqkcD1Yw=;\n b=dmaTSl7t8FgBRUbV1y4X27tYLwMgLqL9JJadDtJg7pOlJGv9Is+gYC16IPOMhECt0C\n FEUXaDjIUbD2M8k1K4g/Nb8uWwUplLjU4/JzBMTGi3NxXdO+rvKeLYl0/VdGG7CANsdT\n xB9XlmjD4tuCDc552wowwqjPDr9xdlqnG5E60Y7PTpb4aC5Te+oVOujtSIpyOa0LbYjp\n AbJcXI1CdxiXWyKYbL1yKsVIB5ti04n+k0OJ8oKKHf3KL/Z8OQaZn3Veqj4toDd24unE\n wJ+cakO4/BS0TeJdlO1XvW3/JLQZGYMh+MAIElgBI9zBtu9WbtS4Nhg2OK1NH0nfpsmG\n NQ8Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776457977; x=1777062777;\n h=content-transfer-encoding:mime-version:message-id:date:subject:to\n :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=YelOjC68Uh1blaR8bkh9GTwV8k1cdQb2ozydqkcD1Yw=;\n b=L4RJjpC7DU+C26bWCcJLuvt/yGHFiym0CvTn9mUklfk8pRKq6bE+MDAkVsXjxgxhcM\n +L0hpy1MK++BmUA+yDct0MdkdYSh0Wov588iUn0zZg56DEZMv7/57JRKgrGh2BrUd7cw\n QNEkjjncGoMiyNKNfiRrilXGOEv+4DWV0I3rTAh3HJ22x4eu0m7US6CeaB1nk3pQGc8F\n CmZykUZG7xL4/XfxgOEiaOwjoromVOYZBNnMCSXoenlX5BmN7jqJViLzsF+2pTg4y75v\n Z5t5cypKHaAD07p/IesWuDfvIZaK6kBM09ShucmS2+OO9K2rMGDkYSCOA5zp0RhkIvIe\n OZgA==","X-Gm-Message-State":"AOJu0YwJ8oThQEhYo2kOvNqOgXhMPvjh+2No45bK3PN9Sajzmon0rgKP\n vswfQ9w6WkMlDAmNccgokeYUvvb0lqEhpSYHwEmxUaHm7S28yui6YvNrqsOSxavqi3aimx+svHf\n eKx0=","X-Gm-Gg":"AeBDietdBF1Tn73PBLcXfMyouePZHfiRKmnivOUrU55w+T2I+1nCHo2zrLM7xNdJQsJ\n xULBj15EStgQPYk4cyKBflfdLkTXndW3HgJTWAOmf8OWaaJGOOKHSwhOCLW17o5WJ4lmZngOh71\n volmP5Y+4YD1G0pBkQt7g7Aejki+lFCCYAAFYngEn7jnlzs6+ENIMSCI9fvUqkNTtJWJLdwJkLG\n Swx/hJPN7ofiX5UuFLRRUU4JDHbmjdtpxeyT2CpnVOqqB777xdHFaSPriRoadmZ3hjn4hgTXLVY\n 302LWrdw2flyRq8QMuR7ylcz9FF0PQBi354vicHV9z/N8fvC7UBhQayMEPhQR3PADLFh/PAZj7J\n kKpyknvhomfBwCfDHsdgQh7sqxXM3l4GLxXfriVlDIJa4NssVRGP6O3nRQ32JRjVSAglHCK507t\n r2SNVCbI0syiqE/cyOMtF5MgYdkevhdmYmWpfYdE0CpnxdYo4=","X-Received":"by 2002:a05:600c:444a:b0:487:1520:d107 with SMTP id\n 5b1f17b1804b1-488fb793580mr59009695e9.31.1776457976884;\n Fri, 17 Apr 2026 13:32:56 -0700 (PDT)","From":"Eric Botcazou <botcazou@adacore.com>","X-Google-Original-From":"Eric Botcazou <ebotcazou@adacore.com>","To":"gcc-patches@gcc.gnu.org","Subject":"[Ada] Fix internal error on decimal literal with huge exponent","Date":"Fri, 17 Apr 2026 22:23:04 +0200","Message-ID":"<2407579.ElGaqSPkdT@fomalhaut>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"nextPart5064845.GXAFRqVoOG\"","Content-Transfer-Encoding":"7Bit","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <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>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"This is a serious contender for the smallest chunk of code still crashing the \ncompiler after three decades.\n\nTested on x86-64/Linux, applied on the mainline.\n\n\n2026-04-17  Eric Botcazou  <ebotcazou@adacore.com>\n\n\tPR ada/107391\n\t* urealp.adb (Decimal_Exponent_Hi): Check that the denominator is\n\tin range before invoking UI_To_Int on it, and cope with failure.\n\t(Decimal_Exponent_Lo): Likewise.\n\n\n2026-04-17  Eric Botcazou  <ebotcazou@adacore.com>\n\n\t* gnat.dg/specs/float_literal1.ads: New test.","diff":"diff --git a/gcc/ada/urealp.adb b/gcc/ada/urealp.adb\nindex 955e5a226dd..0cfeafd67d6 100644\n--- a/gcc/ada/urealp.adb\n+++ b/gcc/ada/urealp.adb\n@@ -173,7 +173,13 @@ package body Urealp is\n \n          begin\n             if Val.Rbase = 10 then\n-               E := UI_To_Int (Val.Den);\n+               if UI_Is_In_Int_Range (Val.Den) then\n+                  E := UI_To_Int (Val.Den);\n+               elsif Val.Den < 0 then\n+                  return Int'Last; -- Saturation to highest exponent\n+               else\n+                  E := Int'Last; -- High estimate\n+               end if;\n \n             else\n                E := Equivalent_Decimal_Exponent (Val);\n@@ -226,7 +232,13 @@ package body Urealp is\n \n          begin\n             if Val.Rbase = 10 then\n-               E := UI_To_Int (Val.Den);\n+               if UI_Is_In_Int_Range (Val.Den) then\n+                  E := UI_To_Int (Val.Den);\n+               elsif Val.Den < 0 then\n+                  return Int'Last; -- Low estimate\n+               else\n+                  return Int'First; -- Saturation to lowest exponent\n+               end if;\n \n             else\n                E := Equivalent_Decimal_Exponent (Val);\n","prefixes":["Ada"]}