Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q6yJJ-0006Dd-2x for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jun 2023 18:55:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q6yJH-0004rc-VL for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jun 2023 18:55:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q6yJH-0004rT-FY for pgsql-hackers@lists.postgresql.org; Wed, 07 Jun 2023 18:55:07 +0000 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q6yJE-000sQA-5K for pgsql-hackers@postgresql.org; Wed, 07 Jun 2023 18:55:06 +0000 Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-bad102ce9eeso8813839276.0 for ; Wed, 07 Jun 2023 11:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1686164102; x=1688756102; h=user-agent:content-disposition:mime-version:message-id:subject:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=OYOfLNESlkhWt5okFDGnk+Tb5ZiWeZWkUQLMDL+vh/A=; b=YmziLT4KRmFoRiFO+qwNq8O3FT1qKA+EWbcx/T78SpIzfVB7RMfMji2DQrcC2wFfgC FfWdZDA8Jt9ll4u1quvHJOdsPlTpNZZ3L3DFnzbRlpwPzpbnclftm/z3ZtplZt9tUgMH xOO6Mo86xP61+uB6y6glQOJpbp0U7cPR2xs4g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686164102; x=1688756102; h=user-agent:content-disposition:mime-version:message-id:subject:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OYOfLNESlkhWt5okFDGnk+Tb5ZiWeZWkUQLMDL+vh/A=; b=FvIcq2uCb5Zvrz+ywW4RGkd3/kwuRj/zg72QS327EBFORQ/FyJHTa4svts1yNmVkkU Hw9gDdVTSjjs17PdNvu8y0QHxEbXfNOP5MUmC8qV8UXsj/+TdlF1mRVRGeHbhGOl6K9n vlWWbWmIEDG7COcD2oB1HDQWP83Kdc4oVTYq7PdSBnGmL5MwvH1h4RBDdWinB56ryilS VwoPdngyXjoptiHv01oTO5PhqA41VIgyMkn6aaIpbWroZiCnfXm6S8G6yTl6e5gVOmtt aq0NyT+l9j1ZD1gcWnKQjQHiOQ7qGEqnGgMQx1HJ6I9ewebXilPM5VtsaJaZQIe4CGEI FZYg== X-Gm-Message-State: AC+VfDzouuoUFOujZYbWEj8BOkDejG/wVuZPx+ur+82gyP5Fkk9X5gAJ QDLo4DiV3wGrlYduU+dvruZca4gmLfhHBI5IofA= X-Google-Smtp-Source: ACHHUZ7RKoxnwv15EAumYsC1Ye4OYjWsoJtdMEQeazzIwpkpkrtAD1ILyNz9bMB6m/eUZQkVRBS1gQ== X-Received: by 2002:a0d:e610:0:b0:561:c147:1d46 with SMTP id p16-20020a0de610000000b00561c1471d46mr7734965ywe.9.1686164102137; Wed, 07 Jun 2023 11:55:02 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id h66-20020a0dde45000000b00564bc2ddca3sm4925275ywe.25.2023.06.07.11.55.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jun 2023 11:55:01 -0700 (PDT) Date: Wed, 7 Jun 2023 11:54:58 -0700 From: Noah Misch To: pgsql-hackers@postgresql.org Subject: v16 fails to build w/ Visual Studio 2015 Message-ID: <20230607185458.GA1334487@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Visual Studio 2015 version "14.0.25431.01 Update 3" has an apparent compiler bug that causes the build to fail with "readfuncs.switch.c(522): fatal error C1026: parser stack overflow, program too complex (compiling source file src/backend/nodes/readfuncs.c)". While I wouldn't mind revoking support for Visual Studio 2015, changing the code to cope is easy. See attached. https://stackoverflow.com/a/34266725/16371536 asserts having confirmation of the compiler bug, but its reference is now a dead link. This became a problem in v16 due to the 135% increase in node types known to parseNodeString(). https:/postgr.es/m/20221124004144.iosgze2qnmcctgsh@awork3.anarazel.de previously reported this error message when overriding USE_READLINE in a Visual Studio build, for tab-complete.c. If that combination ever becomes supported, we may face a similar decision there. --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vs2015-parseNodeString-v1.patch" Author: Noah Misch Commit: Noah Misch Make parseNodeString() C idiom compatible with Visual Studio 2015. Between v15 and now, this function's "else if" chain grew from 252 lines to 592 lines, exceeding a compiler limit that manifests as "fatal error C1026: parser stack overflow, program too complex (compiling source file src/backend/nodes/readfuncs.c)". Use "if (...) return ...;" instead. Reviewed by FIXME. Discussion: https://postgr.es/m/FIXME diff --git a/src/backend/nodes/gen_node_support.pl b/src/backend/nodes/gen_node_support.pl index b89b491..72c7963 100644 --- a/src/backend/nodes/gen_node_support.pl +++ b/src/backend/nodes/gen_node_support.pl @@ -924,9 +924,9 @@ foreach my $n (@node_types) . "\t\t\t\t_out${n}(str, obj);\n" . "\t\t\t\tbreak;\n"; - print $rfs "\telse if (MATCH(\"$N\", " + print $rfs "\tif (MATCH(\"$N\", " . length($N) . "))\n" - . "\t\treturn_value = _read${n}();\n" + . "\t\treturn (Node *) _read${n}();\n" unless $no_read; next if elem $n, @custom_read_write; diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 597e5b3..df72dc3 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -696,8 +696,6 @@ _readExtensibleNode(void) Node * parseNodeString(void) { - void *return_value; - READ_TEMP_LOCALS(); /* Guard against stack overflow due to overly complex expressions */ @@ -708,16 +706,10 @@ parseNodeString(void) #define MATCH(tokname, namelen) \ (length == namelen && memcmp(token, tokname, namelen) == 0) - if (false) - ; #include "readfuncs.switch.c" - else - { - elog(ERROR, "badly formatted node string \"%.32s\"...", token); - return_value = NULL; /* keep compiler quiet */ - } - return (Node *) return_value; + elog(ERROR, "badly formatted node string \"%.32s\"...", token); + return NULL; /* keep compiler quiet */ } --dDRMvlgZJXvWKvBx--