{"id":2224710,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2224710/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/3406888.aeNJFYEL58@fomalhaut/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<3406888.aeNJFYEL58@fomalhaut>","date":"2026-04-17T20:27:51","name":"[Ada] Fix excessive compilation time for decimal literal with large exponent","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2ea65551e420c4d722a70006575b5ba1d86cf055","submitter":{"id":78832,"url":"http://patchwork.ozlabs.org/api/1.1/people/78832/?format=json","name":"Eric Botcazou","email":"botcazou@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/3406888.aeNJFYEL58@fomalhaut/mbox/","series":[{"id":500400,"url":"http://patchwork.ozlabs.org/api/1.1/series/500400/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500400","date":"2026-04-17T20:27:51","name":"[Ada] Fix excessive compilation time for decimal literal with large exponent","version":1,"mbox":"http://patchwork.ozlabs.org/series/500400/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224710/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224710/checks/","tags":{},"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=gUxjir2u;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::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=gUxjir2u","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.53"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4fy66N0ylnz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 06:33:26 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id A2D364C900E6\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 20:33:23 +0000 (GMT)","from mail-wm1-f53.google.com (mail-wm1-f53.google.com\n [209.85.128.53])\n by sourceware.org (Postfix) with ESMTPS id B14024BA23C2\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 20:32:55 +0000 (GMT)","by mail-wm1-f53.google.com with SMTP id\n 5b1f17b1804b1-488b150559bso8471265e9.1\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 13:32:55 -0700 (PDT)","from fomalhaut.localnet ([2a01:e0a:107c:2f10:e654:e8ff:fe8f:2ce6])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488fb74c7cbsm25652255e9.7.2026.04.17.13.32.52\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:53 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org A2D364C900E6","OpenDKIM Filter v2.11.0 sourceware.org B14024BA23C2"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org B14024BA23C2","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org B14024BA23C2","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776457976; cv=none;\n b=G9UUncC9ZPErbPJI2uTePc9+DHNSWge0P33HDgORgr5Q6RxjsnCxij+0szEFX2wpcNv5hIyHG5U2m39rq6YIG6wSkcWQHUYIzh1s0yKKSLtah60Ipl6kF2H/MOUTf0XbwOUJHbvcjgo9SE6TMWQnnyHwGqIKomCES+pkLg3p7mg=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776457976; c=relaxed/simple;\n bh=i0QGN4Y1+1VxMtf0py/KHWxXvxqHxSXcU+Qm2sJJchU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=eNxZHCdjK2dO+eS0HIGi1MvKOx1a2wmOZiC+b77I8JmnKuvrp6cwirvngGff8a2zuDPrFBtL+6aeln7lh4AtPwUHUSQ6O6pw2XXHnRKOXsZf+mC16tNc5roounV1bQUgApdY1IO/JkXBMWgXWETuyLQMtlsjHJ/66y9XoiUCUOc=","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=1776457974; x=1777062774; 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=FNxQBn72SXfP+fmH1xrZHRFhT8TPNubOj9+HQZoW4AU=;\n b=gUxjir2uly7w/XgvuVCgIqvvnO/7Cs/bX0m302jmppeLoHTWq2iPfCU3HK+EC6McWv\n IgH+kteDrPRErZwNypffoZJKmQm4f4xvOYsc73Z6IqySqeWylxHbMQhDoxAn/PQdByeQ\n B/6bqwAYoKW65bnyU/xzCa1EwebPh+iQaduUMw15sPLNgKMI+80+SAl3kcoRP1MFM2ux\n xVT+Bmg7oBnnOLNlJT1cUfu3CrKvFicbhdrgRcmR9BRuYRO5r+lF4Uu2zfI8AiM/7tHx\n qflq/Ut/sal3MCzKAa296NoZMGwU5izw8dbJPZZdwO+CVFdBahwIUX5bjvv0apjjCB+Y\n DL1w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776457974; x=1777062774;\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=FNxQBn72SXfP+fmH1xrZHRFhT8TPNubOj9+HQZoW4AU=;\n b=llWQktbSVa99AN4CFvZrTAPuNVR6VoKqZJjgvR7WNNsiigtbAe4+Yo14sXsnfcPT02\n N5cnPC45StJ3vrkyEGaMsDhOeAjXDuLr8cbtoY9qr2M6nzv0EFr2P9hZ5PMJt6CtAeZD\n hr9jw1UOUSP79zHT4zcJf/3a+Hyip3RBmsd4HQ4BLRalVMEgKBRDa9CRBUl/fWFikIM1\n BttTIteNBJhUXYDuB5lfeh+8Nb6TTmIqjJ21VtSB+LxJ7kQ5innkAMcHk8K3pk3rdckf\n U8IMSBxRsWLsSHKmt3Yfh+FyOF5t1RuCh/KNQpMfYeN6a0JF5LuVThr8RPqPVMEWqPil\n mRwg==","X-Gm-Message-State":"AOJu0Yzk6WWYE2uMxAHq6J1ohd4OLe5eU6NrsYCffn2VbdMDbeu8uTfc\n Uq/4skoT2CZ8L3pmD93m33jFeNhxvGr0L529zM6tAhJgYQo5HcUPfikGM4FmqCyPDs5mJja07km\n MGyc=","X-Gm-Gg":"AeBDietgKfr3u2PTePSVFDPZRQqaokDXJlUr4QQ/3Mjy1j5Bw6Y5SZi5QYCjkl0dUOr\n ytph0/JED3JSKYuxsofQqBPcnBTeU4RVtEe5839J4WyDnlYTI/1LuT1boL3a5xjylnap8n0v+dS\n PHpCFZcu5/1DGvrJxGaoRPGnJOwp8tdj722J8xsxDSbHdq9HYRjENt4Sg1TQmJWjuzlft9m07Ts\n GOxF00Eesyger54Ur81KoDz/vgDG0SyTsCNI5jADclR4zQ9qYp2t+EAdkjkEAvTH6U4+qXnFhWx\n JOjbRhNPrixwnU46Of3IY9LF7pAEfCoSSaxWXpXKHII8+fzZXRqwNs3Da/OYQvMij4BmDWzf8gS\n lef0a5USXpHsNXFDZ8dPD1E38M1wp7uhqPlnfZVmIVuA9ifjKibXlmc91sqQbBplQuAIMMK71tb\n BCGfiLBuDPftctFvzhj8HtmcghgkFXFR9vWvKL0vm1Oj/UXEM=","X-Received":"by 2002:a05:600c:888b:b0:480:1d0b:2d32 with SMTP id\n 5b1f17b1804b1-488fb74bccbmr50413095e9.12.1776457974500;\n Fri, 17 Apr 2026 13:32:54 -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 excessive compilation time for decimal literal with large\n exponent","Date":"Fri, 17 Apr 2026 22:27:51 +0200","Message-ID":"<3406888.aeNJFYEL58@fomalhaut>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"nextPart3413420.44csPzL39Z\"","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 hanging 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/107392\n\t* sem_res.adb: Add clauses for Ttypes.\n\t(Resolve.Patch_Up_Value): Do not try to convert real literals that\n\tdo not fit in Universal_Integer.\n\n\n2026-04-17  Eric Botcazou  <ebotcazou@adacore.com>\n\n        * gnat.dg/specs/float_literal2.ads: New test.","diff":"diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb\nindex e5abc01fc8b..270affe5ccb 100644\n--- a/gcc/ada/sem_res.adb\n+++ b/gcc/ada/sem_res.adb\n@@ -90,6 +90,7 @@ with Strub;          use Strub;\n with Style;          use Style;\n with Targparm;       use Targparm;\n with Tbuild;         use Tbuild;\n+with Ttypes;         use Ttypes;\n with Uintp;          use Uintp;\n with Urealp;         use Urealp;\n with Warnsw;         use Warnsw;\n@@ -2329,9 +2330,16 @@ package body Sem_Res is\n             Set_Is_Static_Expression (N);\n \n          elsif Nkind (N) = N_Real_Literal and then Is_Integer_Type (Typ) then\n-            Rewrite (N,\n-              Make_Integer_Literal (Sloc (N),\n-                Intval => UR_To_Uint (Realval (N))));\n+            if UR_Abs (Realval (N)) < Ureal_2_63\n+              or else (System_Max_Integer_Size = 128\n+                        and then UR_Abs (Realval (N)) < Ureal_2_127)\n+            then\n+               Rewrite (N,\n+                 Make_Integer_Literal (Sloc (N),\n+                   Intval => UR_To_Uint (Realval (N))));\n+            else\n+               Rewrite (N, Make_Integer_Literal (Sloc (N), Intval => Uint_0));\n+            end if;\n             Set_Etype (N, Universal_Integer);\n             Set_Is_Static_Expression (N);\n \n","prefixes":["Ada"]}