From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18344 invoked by alias); 17 Nov 2017 14:09:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 18335 invoked by uid 89); 17 Nov 2017 14:09:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-14.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,KB_WAM_FROM_NAME_SINGLEWORD,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Nov 2017 14:09:49 +0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAHE9kXh000511 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Nov 2017 14:09:46 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vAHE9jCP015650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Nov 2017 14:09:45 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vAHE9joA028654; Fri, 17 Nov 2017 14:09:45 GMT Received: from [192.168.1.4] (/87.19.212.40) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 17 Nov 2017 06:09:45 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill , Nathan Sidwell From: Paolo Carlini Subject: [C++ Patch, V2] PR 82593 ("Internal compiler error: in process_init_constructor_array, at cp/typeck2.c:1294") Message-ID: <44bdbaa0-35f1-7f0c-85aa-b603939d016e@oracle.com> Date: Fri, 17 Nov 2017 14:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------6918615098A80815408CB961" X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg01483.txt.bz2 This is a multi-part message in MIME format. --------------6918615098A80815408CB961 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-length: 626 Hi again, I managed to spend much more time on the issue and I'm starting a new thread with a mature - IMHO - proposal: the big thing is the use of the existing check_array_designated_initializer in process_init_constructor_array,  which calls maybe_constant_value, as we want, and covers all the ill-formed cases which I can imagine. I'm also tweaking a bit the parser to check the return value of require_potential_rvalue_constant_expression in order to avoid redundant diagnostic in some cases. Also, a couple more testcases beyond the bug report. Tested x86_64-linux. Thanks, Paolo. //////////////////////// --------------6918615098A80815408CB961 Content-Type: text/plain; charset=UTF-8; name="CL_82593_2" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="CL_82593_2" Content-length: 757 L2NwCjIwMTctMTEtMTcgIFBhb2xvIENhcmxpbmkgIDxwYW9sby5jYXJsaW5p QG9yYWNsZS5jb20+CgoJUFIgYysrLzgyNTkzCgkqIGRlY2wuYyAoY2hlY2tf YXJyYXlfZGVzaWduYXRlZF9pbml0aWFsaXplcik6IE5vdCBzdGF0aWMuCgkq IGNwLXRyZWUuaCAoY2hlY2tfYXJyYXlfZGVzaWduYXRlZF9pbml0aWFsaXpl cik6IERlY2xhcmUuCgkqIHR5cGVjazIuYyAocHJvY2Vzc19pbml0X2NvbnN0 cnVjdG9yX2FycmF5KTogQ2FsbCB0aGUgbGF0dGVyLgoJKiBwYXJzZXIuYyAo Y3BfcGFyc2VyX2luaXRpYWxpemVyX2xpc3QpOiBDaGVjayB0aGUgcmV0dXJu IHZhbHVlCglvZiByZXF1aXJlX3BvdGVudGlhbF9ydmFsdWVfY29uc3RhbnRf ZXhwcmVzc2lvbi4KCi90ZXN0c3VpdGUKMjAxNy0xMS0xNyAgUGFvbG8gQ2Fy bGluaSAgPHBhb2xvLmNhcmxpbmlAb3JhY2xlLmNvbT4KCglQUiBjKysvODI1 OTMKCSogZysrLmRnL2NwcDB4L2Rlc2lnMi5DOiBOZXcuCgkqIGcrKy5kZy9j cHAweC9kZXNpZzMuQzogTGlrZXdpc2UuCgkqIGcrKy5kZy9jcHAweC9kZXNp ZzQuQzogTGlrZXdpc2UuCg== --------------6918615098A80815408CB961 Content-Type: text/plain; charset=UTF-8; name="patch_82593_2" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="patch_82593_2" Content-length: 5519 SW5kZXg6IGNwL2NwLXRyZWUuaAo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0t LSBjcC9jcC10cmVlLmgJKHJldmlzaW9uIDI1NDg1OCkKKysrIGNwL2NwLXRy ZWUuaAkod29ya2luZyBjb3B5KQpAQCAtNjE5MCw2ICs2MTkwLDggQEAgZXh0 ZXJuIGJvb2wgcmVxdWlyZV9kZWR1Y2VkX3R5cGUJCSh0cmVlLCB0c3Vic3Rf ZmwKIAogZXh0ZXJuIHRyZWUgZmluaXNoX2Nhc2VfbGFiZWwJCQkobG9jYXRp b25fdCwgdHJlZSwgdHJlZSk7CiBleHRlcm4gdHJlZSBjeHhfbWF5YmVfYnVp bGRfY2xlYW51cAkJKHRyZWUsIHRzdWJzdF9mbGFnc190KTsKK2V4dGVybiBi b29sIGNoZWNrX2FycmF5X2Rlc2lnbmF0ZWRfaW5pdGlhbGl6ZXIgIChjb25z dHJ1Y3Rvcl9lbHQgKiwKKwkJCQkJCSB1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4L2Rlc2ln My5DCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHRlc3RzdWl0ZS9nKysu ZGcvY3BwMHgvZGVzaWczLkMJKG5vbmV4aXN0ZW50KQorKysgdGVzdHN1aXRl L2crKy5kZy9jcHAweC9kZXNpZzMuQwkod29ya2luZyBjb3B5KQpAQCAtMCww ICsxLDIxIEBACisvLyBQUiBjKysvODI1OTMKKy8vIHsgZGctZG8gY29tcGls ZSB7IHRhcmdldCBjKysxMSB9IH0KKy8vIHsgZGctb3B0aW9ucyAiIiB9CisK K2NvbnN0IGludCBJTkRFWDEgPSAwOworY29uc3QgaW50IElOREVYMiA9IDE7 CisKK2NsYXNzIFNvbWVDbGFzcyB7CitwdWJsaWM6CisgU29tZUNsYXNzKCk7 Citwcml2YXRlOgorIHN0cnVjdCB7IGludCBmaWVsZDsgfSBtZW1iZXJbMl07 Cit9OworCitTb21lQ2xhc3M6OlNvbWVDbGFzcygpCisgOiBtZW1iZXIoewor ICAgW0lOREVYMV0gPSB7IC5maWVsZCA9IDAgfSwKKyAgIFtJTkRFWDJdID0g eyAuZmllbGQgPSAxIH0KKyB9KQoreworfQpJbmRleDogdGVzdHN1aXRlL2cr Ky5kZy9jcHAweC9kZXNpZzQuQwo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0t LSB0ZXN0c3VpdGUvZysrLmRnL2NwcDB4L2Rlc2lnNC5DCShub25leGlzdGVu dCkKKysrIHRlc3RzdWl0ZS9nKysuZGcvY3BwMHgvZGVzaWc0LkMJKHdvcmtp bmcgY29weSkKQEAgLTAsMCArMSwyMSBAQAorLy8gUFIgYysrLzgyNTkzCisv LyB7IGRnLWRvIGNvbXBpbGUgeyB0YXJnZXQgYysrMTEgfSB9CisvLyB7IGRn LW9wdGlvbnMgIiIgfQorCitpbnQgSU5ERVgxID0gMDsKK2ludCBJTkRFWDIg PSAxOworCitjbGFzcyBTb21lQ2xhc3MgeworcHVibGljOgorIFNvbWVDbGFz cygpOworcHJpdmF0ZToKKyBzdHJ1Y3QgeyBpbnQgZmllbGQ7IH0gbWVtYmVy WzJdOworfTsKKworU29tZUNsYXNzOjpTb21lQ2xhc3MoKQorIDogbWVtYmVy KHsKKyAgIFtJTkRFWDFdID0geyAuZmllbGQgPSAwIH0sICAvLyB7IGRnLWVy cm9yICJjb25zdGFudCBleHByZXNzaW9uIiB9CisgICBbSU5ERVgyXSA9IHsg LmZpZWxkID0gMSB9ICAgLy8geyBkZy1lcnJvciAiY29uc3RhbnQgZXhwcmVz c2lvbiIgfQorIH0pCit7Cit9Cg== --------------6918615098A80815408CB961--