Started by user snail Running as SYSTEM [EnvInject] - Loading node environment variables. Building remotely on docker-jenkins-agent in workspace /home/jenkins/agent/workspace/gcc-patch [WS-CLEANUP] Deleting project workspace... [WS-CLEANUP] Deferred wipeout is used... [WS-CLEANUP] Done The recommended git tool is: NONE using credential 0adb5fc7-caa2-429d-97d2-c7fa2fa1d884 Cloning the remote Git repository Using shallow clone with depth 1 Avoid fetching tags Cloning repository git@github.com:wangliu-iscas/gcc-patch.git/ > git init /home/jenkins/agent/workspace/gcc-patch # timeout=10 Fetching upstream changes from git@github.com:wangliu-iscas/gcc-patch.git/ > git --version # timeout=10 > git --version # 'git version 2.37.2' using GIT_SSH to set credentials patchwork github wangliu-iscas git ssh key Verifying host key using known hosts file, will automatically accept unseen keys > git fetch --no-tags --force --progress --depth=1 -- git@github.com:wangliu-iscas/gcc-patch.git/ +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url git@github.com:wangliu-iscas/gcc-patch.git/ # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 Avoid second fetch > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 18981635127c6701733dc052aa054e569271b733 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 18981635127c6701733dc052aa054e569271b733 # timeout=10 Commit message: "c: C2x storage class specifiers in compound literals" > git rev-list --no-walk 18981635127c6701733dc052aa054e569271b733 # timeout=10 [EnvInject] - Mask passwords that will be passed as build parameters. [EnvInject] - Executing scripts and injecting environment variables after the SCM step. [EnvInject] - Injecting as environment variables the properties content GITHUB_REPO=https://github.com/wangliu-iscas/ PATCHWORK_URL=https://patchwork.plctlab.org [EnvInject] - Variables injected successfully. [gcc-patch] $ /usr/bin/env bash /tmp/jenkins11072146564640314715.sh + git config pull.rebase false + git fetch origin master From github.com:wangliu-iscas/gcc-patch * branch master -> FETCH_HEAD + git checkout master Switched to a new branch 'master' branch 'master' set up to track 'origin/master'. + git pull origin master From github.com:wangliu-iscas/gcc-patch * branch master -> FETCH_HEAD Already up to date. + git fetch origin upstream-master From github.com:wangliu-iscas/gcc-patch * branch upstream-master -> FETCH_HEAD + git checkout upstream-master Switched to a new branch 'upstream-master' branch 'upstream-master' set up to track 'origin/upstream-master'. + git remote add upstream https://github.com/gcc-mirror/gcc.git + git pull upstream master From https://github.com/gcc-mirror/gcc * branch master -> FETCH_HEAD * [new branch] master -> upstream/master Already up to date. + git push -u origin upstream-master Everything up-to-date branch 'upstream-master' set up to track 'origin/upstream-master'. + git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. + git merge upstream-master Already up to date. + git push -u origin master Everything up-to-date branch 'master' set up to track 'origin/master'. + branchname=series1867-patch2463 ++ grep 'series1867-patch2463$' ++ git branch -a + checkbranch= + checkbranchresult=null + '[' null = series1867-patch2463 ']' + git checkout -b series1867-patch2463 Switched to a new branch 'series1867-patch2463' ++ curl https://patchwork.plctlab.org/api/1.2/series/1867/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 1443 100 1443 0 0 19240 0 --:--:-- --:--:-- --:--:-- 19500 + series_response='{"id":1867,"url":"https://patchwork.plctlab.org/api/1.2/series/1867/","web_url":"https://patchwork.plctlab.org/project/gcc-patch/list/?series=1867","project":{"id":1,"url":"https://patchwork.plctlab.org/api/1.2/projects/1/","name":"gcc-patch","link_name":"gcc-patch","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":"https://gcc.gnu.org/mailman/listinfo/gcc-patches","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"name":"[committed] c: C2x storage class specifiers in compound literals","date":"2022-10-14T02:19:37","submitter":{"id":61,"url":"https://patchwork.plctlab.org/api/1.2/people/61/","name":"Joseph Myers","email":"joseph@codesourcery.com"},"version":1,"total":1,"received_total":1,"received_all":true,"mbox":"https://patchwork.plctlab.org/series/1867/mbox/","cover_letter":null,"patches":[{"id":2463,"url":"https://patchwork.plctlab.org/api/1.2/patches/2463/","web_url":"https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/","msgid":"","list_archive_url":null,"date":"2022-10-14T02:19:37","name":"[committed] c: C2x storage class specifiers in compound literals","mbox":"https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/"}]}' ++ jq '.patches[] | (.id|tostring) + "," + .mbox' ++ echo '{"id":1867,"url":"https://patchwork.plctlab.org/api/1.2/series/1867/","web_url":"https://patchwork.plctlab.org/project/gcc-patch/list/?series=1867","project":{"id":1,"url":"https://patchwork.plctlab.org/api/1.2/projects/1/","name":"gcc-patch","link_name":"gcc-patch","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":"https://gcc.gnu.org/mailman/listinfo/gcc-patches","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"name":"[committed] c: C2x storage class specifiers in compound literals","date":"2022-10-14T02:19:37","submitter":{"id":61,"url":"https://patchwork.plctlab.org/api/1.2/people/61/","name":"Joseph Myers","email":"joseph@codesourcery.com"},"version":1,"total":1,"received_total":1,"received_all":true,"mbox":"https://patchwork.plctlab.org/series/1867/mbox/","cover_letter":null,"patches":[{"id":2463,"url":"https://patchwork.plctlab.org/api/1.2/patches/2463/","web_url":"https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/","msgid":"","list_archive_url":null,"date":"2022-10-14T02:19:37","name":"[committed] c: C2x storage class specifiers in compound literals","mbox":"https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/"}]}' + patchid_patchurl='"2463,https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/"' + IFS=, + read -r series_patch_id series_patch_url + echo '"2463,https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/"' ++ sed 's/"//g' ++ echo '"2463' + series_patch_id=2463 ++ sed 's/"//g' ++ echo 'https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/"' + series_patch_url=https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++ git rev-parse HEAD + commitid_before=18981635127c6701733dc052aa054e569271b733 + eval '+++ declare -p bout bret declare -- bout="Applying: c: C2x storage class specifiers in compound literals Using index info to reconstruct a base tree... M gcc/c/c-decl.cc M gcc/c/c-parser.cc M gcc/c/c-tree.h M gcc/c/c-typeck.cc Falling back to patching base and 3-way merge... No changes -- Patch already applied." declare -- bret="0" ++ berr='\''++++ git_am https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ patch_url=https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ git am -3 --empty=drop ++++ curl https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 30761 100 30761 0 0 179k 0 --:--:-- --:--:-- --:--:-- 179k +++ bout='\''\'\'''\''Applying: c: C2x storage class specifiers in compound literals Using index info to reconstruct a base tree... M gcc/c/c-decl.cc M gcc/c/c-parser.cc M gcc/c/c-tree.h M gcc/c/c-typeck.cc Falling back to patching base and 3-way merge... No changes -- Patch already applied.'\''\'\'''\'' +++ bret=0'\'' ++ declare -p berr declare -- berr="++++ git_am https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ patch_url=https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ git am -3 --empty=drop ++++ curl https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 30761 100 30761 0 0 179k 0 --:--:-- --:--:-- --:--:-- 179k +++ bout='\''Applying: c: C2x storage class specifiers in compound literals Using index info to reconstruct a base tree... M gcc/c/c-decl.cc M gcc/c/c-parser.cc M gcc/c/c-tree.h M gcc/c/c-typeck.cc Falling back to patching base and 3-way merge... No changes -- Patch already applied.'\'' +++ bret=0"' ++ +++ declare -p bout bret /tmp/jenkins11072146564640314715.sh: line 85: +++: command not found ++ declare -- 'bout=Applying: c: C2x storage class specifiers in compound literals Using index info to reconstruct a base tree... M gcc/c/c-decl.cc M gcc/c/c-parser.cc M gcc/c/c-tree.h M gcc/c/c-typeck.cc Falling back to patching base and 3-way merge... No changes -- Patch already applied.' ++ declare -- bret=0 ++ ++ 'berr=++++ git_am https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ patch_url=https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ git am -3 --empty=drop ++++ curl https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 30761 100 30761 0 0 179k 0 --:--:-- --:--:-- --:--:-- 179k +++ bout='\''Applying: c: C2x storage class specifiers in compound literals Using index info to reconstruct a base tree... M gcc/c/c-decl.cc M gcc/c/c-parser.cc M gcc/c/c-tree.h M gcc/c/c-typeck.cc Falling back to patching base and 3-way merge... No changes -- Patch already applied.'\'' +++ bret=0' /tmp/jenkins11072146564640314715.sh: line 110: ++: command not found ++ ++ declare -p berr /tmp/jenkins11072146564640314715.sh: line 111: ++: command not found ++ declare -- 'berr=++++ git_am https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ patch_url=https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ ++++ git am -3 --empty=drop ++++ curl https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 30761 100 30761 0 0 179k 0 --:--:-- --:--:-- --:--:-- 179k +++ bout='\''Applying: c: C2x storage class specifiers in compound literals Using index info to reconstruct a base tree... M gcc/c/c-decl.cc M gcc/c/c-parser.cc M gcc/c/c-tree.h M gcc/c/c-typeck.cc Falling back to patching base and 3-way merge... No changes -- Patch already applied.'\'' +++ bret=0' ++ git rev-parse HEAD + commitid_after=18981635127c6701733dc052aa054e569271b733 + '[' 0 = 0 ']' + '[' 18981635127c6701733dc052aa054e569271b733 = 18981635127c6701733dc052aa054e569271b733 ']' + submit_check warning 'Repeat Merge' https://patchwork.plctlab.org/jenkins/job/gcc-patch/1274/consoleText 'Git am fail log' + check_state=warning + patch_state='Repeat Merge' + repo_url=https://patchwork.plctlab.org/jenkins/job/gcc-patch/1274/consoleText + DESCRIPTION='Git am fail log' + curl -X POST -H 'Authorization: Token [*******]' -F state=warning -F target_url=https://patchwork.plctlab.org/jenkins/job/gcc-patch/1274/consoleText -F context=gcc-patch-check -F 'description=Git am fail log' https://patchwork.plctlab.org/api/patches/2463/checks/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 962 100 422 100 540 11105 14210 --:--:-- --:--:-- --:--:-- 25315 {"id":951,"url":"https://patchwork.plctlab.org/api/patches/2463/checks/951/","user":{"id":1,"url":"https://patchwork.plctlab.org/api/users/1/","username":"snail","first_name":"","last_name":"","email":"wangliu@iscas.ac.cn"},"date":"2022-10-14T04:15:55.927944","state":"warning","target_url":"https://patchwork.plctlab.org/jenkins/job/gcc-patch/1274/consoleText","context":"gcc-patch-check","description":"Git am fail log"}+ curl -X PATCH -H 'Authorization: Token [*******]' -F 'state=Repeat Merge' https://patchwork.plctlab.org/api/1.2/patches/2463/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{"id":2463,"url":"https://patchwork.plctlab.org/api/1.2/patches/2463/","web_url":"https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/","project":{"id":1,"url":"https://patchwork.plctlab.org/api/1.2/projects/1/","name":"gcc-patch","link_name":"gcc-patch","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":"https://gcc.gnu.org/mailman/listinfo/gcc-patches","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"","list_archive_url":null,"date":"2022-10-14T02:19:37","name":"[committed] c: C2x storage class specifiers in compound literals","commit_ref":null,"pull_url":null,"state":"repeat-merge","archived":false,"hash":"f2ff2369954c30500083225bd11db8ae197fbc91","submitter":{"id":61,"url":"https://patchwork.plctlab.org/api/1.2/people/61/","name":"Joseph Myers","email":"joseph@codesourcery.com"},"delegate":null,"mbox":"https://patchwork.plctlab.org/project/gcc-patch/patch/alpine.DEB.2.22.394.2210140219040.2099903@digraph.polyomino.org.uk/mbox/","series":[{"id":1867,"url":"https://patchwork.plctlab.org/api/1.2/series/1867/","web_url":"https://patchwork.plctlab.org/project/gcc-patch/list/?series=1867","date":"2022-10-14T02:19:37","name":"[committed] c: C2x storage class specifiers in compound literals","version":1,"mbox":"https://patchwork.plctlab.org/series/1867/mbox/"}],"comments":"https://patchwork.plctlab.org/api/patches/2463/comments/","check":"warning","checks":"https://patchwork.plctlab.org/api/patches/2463/checks/","tags":{},"headers":{"Return-Path":"","Delivered-To":["ouuuleilei@gmail.com","gcc-patches@gcc.gnu.org"],"Received":["by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp577621wrs;\n Thu, 13 Oct 2022 19:20:25 -0700 (PDT)","from sourceware.org (server2.sourceware.org.\n [2620:52:3:1:0:246e:9693:128c])\n by mx.google.com with ESMTPS id\n qk19-20020a1709077f9300b0078e19037659si1151239ejc.792.2022.10.13.19.20.24\n for \n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 13 Oct 2022 19:20:25 -0700 (PDT)","from server2.sourceware.org (localhost [IPv6:::1])\n\tby sourceware.org (Postfix) with ESMTP id CFE15385AC2C\n\tfor ; Fri, 14 Oct 2022 02:20:12 +0000 (GMT)","from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252])\n by sourceware.org (Postfix) with ESMTPS id B8CB03858C56\n for ; Fri, 14 Oct 2022 02:19:45 +0000 (GMT)","from orw-gwy-01-in.mentorg.com ([192.94.38.165])\n by esa4.mentor.iphmx.com with ESMTP; 13 Oct 2022 18:19:43 -0800"],"X-Google-Smtp-Source":"\n AMsMyM6AX4srvWR153K5PkANkDpSXnlxbgmmfGAbQHzvCkn7Gj9actVOyNu3Bp1Qs26d9C1aXY62","X-Received":"by 2002:a17:907:6eab:b0:78d:4c16:a687 with SMTP id\n sh43-20020a1709076eab00b0078d4c16a687mr1862165ejc.392.1665714025183;\n Thu, 13 Oct 2022 19:20:25 -0700 (PDT)","ARC-Seal":"i=1; a=rsa-sha256; t=1665714025; cv=none;\n d=google.com; s=arc-20160816;\n b=iCPk4fww2RiEWMbfNM+ubFhiGrpY/MZSaNbZaw6N6vveX8/faazZwgNbXp1WQiNhDE\n vOG4f5RciiI3m9+9/CSXDY0ODs+NF56oOTyPjxMK3S/WRD9dR6cfs/rfQlgWCdUs9O0f\n O+i88CtgRyVv3bRIA/rpmbba3BkzWcU3Z/QhH37uYTEmxeEp4t/E5YI7YsQ72swEan9r\n lqJ5yVZeYne/Xn+6dSlnZ/NkEXi9UZHXk3mY9nICgXEgmoWLb3YB5ZyqUkAg7zA6LNXg\n qiB+UOAdPCLL+0Btiasx0W3XSYLeWBfR1vBdrs6PIvQacgVL5lRMv9y5Dd0lCAkE4l5G\n NGqg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20160816;\n h=sender:errors-to:list-subscribe:list-help:list-post:list-archive\n :list-unsubscribe:list-id:precedence:mime-version:user-agent\n :message-id:subject:to:from:date:ironport-sdr:dmarc-filter\n :delivered-to;\n bh=n111OkDr03HNb5ixrJtjjHHmUYu5OCzkO+1exoY97Js=;\n b=0fKjKg3m5SO7NXKnB18L3NuLnTOYIcd7YKt3R7Xeh7KW7D0a32q08+GeHgrlOOqLwB\n o05l9mieSZhRupbtJMghSTZbvC6fEfWCEFKbNt/OBNeWACYr5wnQe8gx8cCGd7GGVJhq\n nfdbXtgO2UYHY1ceyXy6iUXr+HHzvnBfpl8gBRNdZ080YY53fjUFjaEJmdydo3bFMNft\n sxQ0y4yTyOSVbnUfGl71lecjge2pw1H0GAQYQR+KhlaOdOm/9t1UXvWP6toDcsTRrTw9\n ZXB45vsLbFte4ueGNyGCUxEmskmGTi21eWtmhoXKwUQrmvgGO0Ha5/NApAcboZXWpZ5b\n o7fQ==","ARC-Authentication-Results":"i=1; mx.google.com;\n spf=pass (google.com: domain of\n gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates\n 2620:52:3:1:0:246e:9693:128c as permitted sender)\n smtp.mailfrom=\"gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org\"","Received-SPF":"pass (google.com: domain of\n gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates\n 2620:52:3:1:0:246e:9693:128c as permitted sender)\n client-ip=2620:52:3:1:0:246e:9693:128c;","Authentication-Results":["mx.google.com;\n spf=pass (google.com: domain of\n gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates\n 2620:52:3:1:0:246e:9693:128c as permitted sender)\n smtp.mailfrom=\"gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org\"","sourceware.org; dmarc=none (p=none dis=none)\n header.from=codesourcery.com","sourceware.org; spf=pass smtp.mailfrom=mentor.com"],"X-Original-To":"gcc-patches@gcc.gnu.org","DMARC-Filter":"OpenDMARC Filter v1.4.1 sourceware.org B8CB03858C56","X-IronPort-AV":"E=Sophos;i=\"5.95,182,1661846400\"; d=\"scan'208\";a=\"84690922\"","IronPort-SDR":"\n xsbcCFjiu96ftwhBHZIAyLBTeG7rleQxa047AwneYtXoz2Lj/DYT9tVtyv1TrfL67O/xRZ+ycM\n XzfV12883pIYwtAf/Ws4NoC2O7jM2wr/ORIGvj/J6Bt5fqxnMCcYCF0QjgZ7QdsT8bSJStVoIu\n o3RsNnT6DTd0z//f0pxsdHmDbp4wTpI75dhEEerzlSzJtyIqLLmqmzaFG8u2VYjaiqDPsX/EQL\n cWwB0T913k+tOXY/tyJY519kgUYVC4r3EJP8g8VXi8Eglmq9Nyf9CElHU6cSxkdsdL71w/igMf\n oqA=","Date":"Fri, 14 Oct 2022 02:19:37 +0000","From":"Joseph Myers ","X-X-Sender":"jsm28@digraph.polyomino.org.uk","To":"","Subject":"[committed] c: C2x storage class specifiers in compound literals","Message-ID":"\n ","User-Agent":"Alpine 2.22 (DEB 394 2020-01-19)","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"US-ASCII\"","X-Originating-IP":"[137.202.0.90]","X-ClientProxiedBy":"svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To\n svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10)","X-Spam-Status":"No, score=-3116.7 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS,\n TXREP autolearn=ham autolearn_force=no version=3.4.6","X-Spam-Checker-Version":"SpamAssassin 3.4.6 (2021-04-09) on\n server2.sourceware.org","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Gcc-patches mailing list ","List-Unsubscribe":",\n ","List-Archive":"","List-Post":"","List-Help":"","List-Subscribe":",\n ","Errors-To":"gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org","Sender":"\"Gcc-patches\" ","X-getmail-retrieved-from-mailbox":"=?utf-8?q?INBOX?=","X-GMAIL-THRID":"=?utf-8?q?1746627749809213235?=","X-GMAIL-MSGID":"=?utf-8?q?1746627749809213235?="},"content":"Implement the C2x feature of storage class specifiers in compound\nliterals. Such storage class specifiers (static, register or\nthread_local; also constexpr, but we don't yet have C2x constexpr\nsupport implemented) can be used before the type name (not mixed with\ntype specifiers, unlike in declarations) and have the same semantics\nand constraints as for declarations of named objects. Also allow GNU\n__thread to be used, given that thread_local can be.\n\nBootstrapped with no regressions for x86_64-pc-linux-gnu.\n\ngcc/c/\n\t* c-decl.cc (build_compound_literal): Add parameter scspecs.\n\tHandle storage class specifiers.\n\t* c-parser.cc (c_token_starts_compound_literal)\n\t(c_parser_compound_literal_scspecs): New.\n\t(c_parser_postfix_expression_after_paren_type): Add parameter\n\tscspecs. Call pedwarn_c11 for use of storage class specifiers.\n\tUpdate call to build_compound_literal.\n\t(c_parser_cast_expression, c_parser_sizeof_expression)\n\t(c_parser_alignof_expression): Handle storage class specifiers for\n\tcompound literals. Update calls to\n\tc_parser_postfix_expression_after_paren_type.\n\t(c_parser_postfix_expression): Update syntax comment.\n\t* c-tree.h (build_compound_literal): Update prototype.\n\t* c-typeck.cc (c_mark_addressable): Diagnose taking address of\n\tregister compound literal.\n\ngcc/testsuite/\n\t* gcc.dg/c11-complit-1.c, gcc.dg/c11-complit-2.c,\n\tgcc.dg/c11-complit-3.c, gcc.dg/c2x-complit-2.c,\n\tgcc.dg/c2x-complit-3.c, gcc.dg/c2x-complit-4.c,\n\tgcc.dg/c2x-complit-5.c, gcc.dg/c2x-complit-6.c,\n\tgcc.dg/c2x-complit-7.c, gcc.dg/c90-complit-2.c,\n\tgcc.dg/gnu2x-complit-1.c, gcc.dg/gnu2x-complit-2.c: New tests.","diff":"diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc\nindex 193e268f04e..a7571cc7542 100644\n--- a/gcc/c/c-decl.cc\n+++ b/gcc/c/c-decl.cc\n@@ -6048,11 +6048,13 @@ mark_forward_parm_decls (void)\n literal. NON_CONST is true if the initializers contain something\n that cannot occur in a constant expression. If ALIGNAS_ALIGN is nonzero,\n it is the (valid) alignment for this compound literal, as specified\n- with _Alignas. */\n+ with _Alignas. SCSPECS are the storage class specifiers (C2x) from the\n+ compound literal. */\n \n tree\n build_compound_literal (location_t loc, tree type, tree init, bool non_const,\n-\t\t\tunsigned int alignas_align)\n+\t\t\tunsigned int alignas_align,\n+\t\t\tstruct c_declspecs *scspecs)\n {\n /* We do not use start_decl here because we have a type, not a declarator;\n and do not use finish_decl because the decl should be stored inside\n@@ -6060,15 +6062,33 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const,\n tree decl;\n tree complit;\n tree stmt;\n+ bool threadp = scspecs ? scspecs->thread_p : false;\n+ enum c_storage_class storage_class = (scspecs\n+\t\t\t\t\t? scspecs->storage_class\n+\t\t\t\t\t: csc_none);\n \n if (type == error_mark_node\n || init == error_mark_node)\n return error_mark_node;\n \n+ if (current_scope == file_scope && storage_class == csc_register)\n+ {\n+ error_at (loc, \"file-scope compound literal specifies %\");\n+ storage_class = csc_none;\n+ }\n+\n+ if (current_scope != file_scope && threadp && storage_class == csc_none)\n+ {\n+ error_at (loc, \"compound literal implicitly auto and declared %qs\",\n+\t\tscspecs->thread_gnu_p ? \"__thread\" : \"_Thread_local\");\n+ threadp = false;\n+ }\n+\n decl = build_decl (loc, VAR_DECL, NULL_TREE, type);\n DECL_EXTERNAL (decl) = 0;\n TREE_PUBLIC (decl) = 0;\n- TREE_STATIC (decl) = (current_scope == file_scope);\n+ TREE_STATIC (decl) = (current_scope == file_scope\n+\t\t\t|| storage_class == csc_static);\n DECL_CONTEXT (decl) = current_function_decl;\n TREE_USED (decl) = 1;\n DECL_READ_P (decl) = 1;\n@@ -6076,6 +6096,13 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const,\n DECL_IGNORED_P (decl) = 1;\n C_DECL_COMPOUND_LITERAL_P (decl) = 1;\n TREE_TYPE (decl) = type;\n+ if (threadp)\n+ set_decl_tls_model (decl, decl_default_tls_model (decl));\n+ if (storage_class == csc_register)\n+ {\n+ C_DECL_REGISTER (decl) = 1;\n+ DECL_REGISTER (decl) = 1;\n+ }\n c_apply_type_quals_to_decl (TYPE_QUALS (strip_array_types (type)), decl);\n if (alignas_align)\n {\ndiff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc\nindex 89e05870f47..602e0235f2d 100644\n--- a/gcc/c/c-parser.cc\n+++ b/gcc/c/c-parser.cc\n@@ -666,6 +666,30 @@ c_parser_next_tokens_start_typename (c_parser *parser, enum c_lookahead_kind la)\n return false;\n }\n \n+/* Return true if TOKEN, after an open parenthesis, can start a\n+ compound literal (either a storage class specifier allowed in that\n+ context, or a type name), false otherwise. */\n+static bool\n+c_token_starts_compound_literal (c_token *token)\n+{\n+ switch (token->type)\n+ {\n+ case CPP_KEYWORD:\n+ switch (token->keyword)\n+\t{\n+\tcase RID_REGISTER:\n+\tcase RID_STATIC:\n+\tcase RID_THREAD:\n+\t return true;\n+\tdefault:\n+\t break;\n+\t}\n+ /* Fall through. */\n+ default:\n+ return c_token_starts_typename (token);\n+ }\n+}\n+\n /* Return true if TOKEN is a type qualifier, false otherwise. */\n static bool\n c_token_is_qualifier (c_token *token)\n@@ -1563,6 +1587,7 @@ static struct c_expr c_parser_sizeof_expression (c_parser *);\n static struct c_expr c_parser_alignof_expression (c_parser *);\n static struct c_expr c_parser_postfix_expression (c_parser *);\n static struct c_expr c_parser_postfix_expression_after_paren_type (c_parser *,\n+\t\t\t\t\t\t\t\t struct c_declspecs *,\n \t\t\t\t\t\t\t\t struct c_type_name *,\n \t\t\t\t\t\t\t\t location_t);\n static struct c_expr c_parser_postfix_expression_after_primary (c_parser *,\n@@ -8237,6 +8262,34 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after,\n #undef POP\n }\n \n+/* Parse any storage class specifiers after an open parenthesis in a\n+ context where a compound literal is permitted. */\n+\n+static struct c_declspecs *\n+c_parser_compound_literal_scspecs (c_parser *parser)\n+{\n+ bool seen_scspec = false;\n+ struct c_declspecs *specs = build_null_declspecs ();\n+ while (c_parser_next_token_is (parser, CPP_KEYWORD))\n+ {\n+ switch (c_parser_peek_token (parser)->keyword)\n+\t{\n+\tcase RID_REGISTER:\n+\tcase RID_STATIC:\n+\tcase RID_THREAD:\n+\t seen_scspec = true;\n+\t declspecs_add_scspec (c_parser_peek_token (parser)->location,\n+\t\t\t\tspecs, c_parser_peek_token (parser)->value);\n+\t c_parser_consume_token (parser);\n+\t break;\n+\tdefault:\n+\t goto out;\n+\t}\n+ }\n+ out:\n+ return seen_scspec ? specs : NULL;\n+}\n+\n /* Parse a cast expression (C90 6.3.4, C99 6.5.4, C11 6.5.4). If AFTER\n is not NULL then it is an Objective-C message expression which is the\n primary-expression starting the expression as an initializer.\n@@ -8260,13 +8313,15 @@ c_parser_cast_expression (c_parser *parser, struct c_expr *after)\n an unary expression. Full detection of unknown typenames here\n would require a 3-token lookahead. */\n if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)\n- && c_token_starts_typename (c_parser_peek_2nd_token (parser)))\n+ && c_token_starts_compound_literal (c_parser_peek_2nd_token (parser)))\n {\n+ struct c_declspecs *scspecs;\n struct c_type_name *type_name;\n struct c_expr ret;\n struct c_expr expr;\n matching_parens parens;\n parens.consume_open (parser);\n+ scspecs = c_parser_compound_literal_scspecs (parser);\n type_name = c_parser_type_name (parser, true);\n parens.skip_until_found_close (parser);\n if (type_name == NULL)\n@@ -8281,8 +8336,11 @@ c_parser_cast_expression (c_parser *parser, struct c_expr *after)\n used_types_insert (type_name->specs->type);\n \n if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))\n-\treturn c_parser_postfix_expression_after_paren_type (parser, type_name,\n+\treturn c_parser_postfix_expression_after_paren_type (parser, scspecs,\n+\t\t\t\t\t\t\t type_name,\n \t\t\t\t\t\t\t cast_loc);\n+ if (scspecs)\n+\terror_at (cast_loc, \"storage class specifier in cast\");\n if (type_name->specs->alignas_p)\n \terror_at (type_name->specs->locations[cdw_alignas],\n \t\t \"alignment specified for type name in cast\");\n@@ -8485,14 +8543,16 @@ c_parser_sizeof_expression (c_parser *parser)\n c_inhibit_evaluation_warnings++;\n in_sizeof++;\n if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)\n- && c_token_starts_typename (c_parser_peek_2nd_token (parser)))\n+ && c_token_starts_compound_literal (c_parser_peek_2nd_token (parser)))\n {\n /* Either sizeof ( type-name ) or sizeof unary-expression\n \t starting with a compound literal. */\n+ struct c_declspecs *scspecs;\n struct c_type_name *type_name;\n matching_parens parens;\n parens.consume_open (parser);\n expr_loc = c_parser_peek_token (parser)->location;\n+ scspecs = c_parser_compound_literal_scspecs (parser);\n type_name = c_parser_type_name (parser, true);\n parens.skip_until_found_close (parser);\n finish = parser->tokens_buf[0].location;\n@@ -8508,13 +8568,15 @@ c_parser_sizeof_expression (c_parser *parser)\n \t}\n if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))\n \t{\n-\t expr = c_parser_postfix_expression_after_paren_type (parser,\n+\t expr = c_parser_postfix_expression_after_paren_type (parser, scspecs,\n \t\t\t\t\t\t\t type_name,\n \t\t\t\t\t\t\t expr_loc);\n \t finish = expr.get_finish ();\n \t goto sizeof_expr;\n \t}\n /* sizeof ( type-name ). */\n+ if (scspecs)\n+\terror_at (expr_loc, \"storage class specifier in %\");\n if (type_name->specs->alignas_p)\n \terror_at (type_name->specs->locations[cdw_alignas],\n \t\t \"alignment specified for type name in %\");\n@@ -8572,16 +8634,18 @@ c_parser_alignof_expression (c_parser *parser)\n c_inhibit_evaluation_warnings++;\n in_alignof++;\n if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)\n- && c_token_starts_typename (c_parser_peek_2nd_token (parser)))\n+ && c_token_starts_compound_literal (c_parser_peek_2nd_token (parser)))\n {\n /* Either __alignof__ ( type-name ) or __alignof__\n \t unary-expression starting with a compound literal. */\n location_t loc;\n+ struct c_declspecs *scspecs;\n struct c_type_name *type_name;\n struct c_expr ret;\n matching_parens parens;\n parens.consume_open (parser);\n loc = c_parser_peek_token (parser)->location;\n+ scspecs = c_parser_compound_literal_scspecs (parser);\n type_name = c_parser_type_name (parser, true);\n end_loc = c_parser_peek_token (parser)->location;\n parens.skip_until_found_close (parser);\n@@ -8597,12 +8661,14 @@ c_parser_alignof_expression (c_parser *parser)\n \t}\n if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))\n \t{\n-\t expr = c_parser_postfix_expression_after_paren_type (parser,\n+\t expr = c_parser_postfix_expression_after_paren_type (parser, scspecs,\n \t\t\t\t\t\t\t type_name,\n \t\t\t\t\t\t\t loc);\n \t goto alignof_expr;\n \t}\n /* alignof ( type-name ). */\n+ if (scspecs)\n+\terror_at (loc, \"storage class specifier in %qE\", alignof_spelling);\n if (type_name->specs->alignas_p)\n \terror_at (type_name->specs->locations[cdw_alignas],\n \t\t \"alignment specified for type name in %qE\",\n@@ -9140,8 +9206,8 @@ c_parser_predefined_identifier (c_parser *parser)\n postfix-expression -> identifier\n postfix-expression ++\n postfix-expression --\n- ( type-name ) { initializer-list }\n- ( type-name ) { initializer-list , }\n+ ( storage-class-specifiers[opt] type-name ) { initializer-list[opt] }\n+ ( storage-class-specifiers[opt] type-name ) { initializer-list , }\n \n argument-expression-list:\n argument-expression\n@@ -10483,6 +10549,7 @@ c_parser_postfix_expression (c_parser *parser)\n \n static struct c_expr\n c_parser_postfix_expression_after_paren_type (c_parser *parser,\n+\t\t\t\t\t struct c_declspecs *scspecs,\n \t\t\t\t\t struct c_type_name *type_name,\n \t\t\t\t\t location_t type_loc)\n {\n@@ -10515,7 +10582,11 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,\n type = error_mark_node;\n }\n \n- pedwarn_c90 (start_loc, OPT_Wpedantic, \"ISO C90 forbids compound literals\");\n+ if (!pedwarn_c90 (start_loc, OPT_Wpedantic,\n+\t\t \"ISO C90 forbids compound literals\") && scspecs)\n+ pedwarn_c11 (start_loc, OPT_Wpedantic,\n+\t\t \"ISO C forbids storage class specifiers in compound literals \"\n+\t\t \"before C2X\");\n non_const = ((init.value && TREE_CODE (init.value) == CONSTRUCTOR)\n \t ? CONSTRUCTOR_NON_CONST (init.value)\n \t : init.original_code == C_MAYBE_CONST_EXPR);\n@@ -10534,7 +10605,7 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,\n \t}\n }\n expr.value = build_compound_literal (start_loc, type, init.value, non_const,\n-\t\t\t\t alignas_align);\n+\t\t\t\t alignas_align, scspecs);\n set_c_expr_source_range (&expr, init.src_range);\n expr.m_decimal = 0;\n expr.original_code = ERROR_MARK;\ndiff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h\nindex 46a3e8e9709..e7cdd2f11dc 100644\n--- a/gcc/c/c-tree.h\n+++ b/gcc/c/c-tree.h\n@@ -734,7 +734,7 @@ extern void set_init_label (location_t, tree, location_t, struct obstack *);\n extern void process_init_element (location_t, struct c_expr, bool,\n \t\t\t\t struct obstack *);\n extern tree build_compound_literal (location_t, tree, tree, bool,\n-\t\t\t\t unsigned int);\n+\t\t\t\t unsigned int, struct c_declspecs *);\n extern void check_compound_literal_type (location_t, struct c_type_name *);\n extern tree c_start_switch (location_t, location_t, tree, bool);\n extern void c_finish_switch (tree, tree);\ndiff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc\nindex f9190680a3c..017658070f4 100644\n--- a/gcc/c/c-typeck.cc\n+++ b/gcc/c/c-typeck.cc\n@@ -5114,6 +5114,11 @@ c_mark_addressable (tree exp, bool array_ref_p)\n \tbreak;\n \n case COMPOUND_LITERAL_EXPR:\n+\tif (C_DECL_REGISTER (COMPOUND_LITERAL_EXPR_DECL (x)))\n+\t {\n+\t error (\"address of register compound literal requested\");\n+\t return false;\n+\t }\n \tTREE_ADDRESSABLE (x) = 1;\n \tTREE_ADDRESSABLE (COMPOUND_LITERAL_EXPR_DECL (x)) = 1;\n \treturn true;\ndiff --git a/gcc/testsuite/gcc.dg/c11-complit-1.c b/gcc/testsuite/gcc.dg/c11-complit-1.c\nnew file mode 100644\nindex 00000000000..e191cebbb6a\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c11-complit-1.c\n@@ -0,0 +1,7 @@\n+/* Test C2x storage class specifiers in compound literals not permitted for\n+ C11. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c11 -pedantic-errors\" } */\n+\n+int *ps = &(static int) { 1 }; /* { dg-error \"forbids storage class specifiers in compound literals\" } */\n+int ss = sizeof (static int) { 1 }; /* { dg-error \"forbids storage class specifiers in compound literals\" } */\ndiff --git a/gcc/testsuite/gcc.dg/c11-complit-2.c b/gcc/testsuite/gcc.dg/c11-complit-2.c\nnew file mode 100644\nindex 00000000000..d4d1f16f62e\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c11-complit-2.c\n@@ -0,0 +1,7 @@\n+/* Test C2x storage class specifiers in compound literals not permitted for\n+ C11. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c11 -pedantic\" } */\n+\n+int *ps = &(static int) { 1 }; /* { dg-warning \"forbids storage class specifiers in compound literals\" } */\n+int ss = sizeof (static int) { 1 }; /* { dg-warning \"forbids storage class specifiers in compound literals\" } */\ndiff --git a/gcc/testsuite/gcc.dg/c11-complit-3.c b/gcc/testsuite/gcc.dg/c11-complit-3.c\nnew file mode 100644\nindex 00000000000..a73a8ef8ae1\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c11-complit-3.c\n@@ -0,0 +1,7 @@\n+/* Test C2x storage class specifiers in compound literals not permitted for\n+ C11, but -Wno-c11-c2x-compat disables the -pedantic diagnostic for that. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c11 -pedantic-errors -Wno-c11-c2x-compat\" } */\n+\n+int *ps = &(static int) { 1 };\n+int ss = sizeof (static int) { 1 };\ndiff --git a/gcc/testsuite/gcc.dg/c2x-complit-2.c b/gcc/testsuite/gcc.dg/c2x-complit-2.c\nnew file mode 100644\nindex 00000000000..dcca5e8d348\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c2x-complit-2.c\n@@ -0,0 +1,48 @@\n+/* Test C2x storage class specifiers in compound literals. */\n+/* { dg-do run } */\n+/* { dg-options \"-std=c2x -pedantic-errors\" } */\n+\n+#include \n+\n+extern void abort (void);\n+extern void exit (int);\n+\n+/* static is OK (although redundant) at file scope. */\n+int *ps = &(static int) { 1 };\n+size_t ss = sizeof (static int) { 1 };\n+int *psa = (static int [3]) { 1, 2, 3 };\n+\n+int\n+main ()\n+{\n+ if (ps[0] != 1)\n+ abort ();\n+ if (ss != sizeof (int))\n+ abort ();\n+ if (psa[0] != 1 || psa[1] != 2 || psa[2] != 3)\n+ abort ();\n+ if ((register int) { 3 } != 3)\n+ abort ();\n+ /* A static compound literal, like a static variable, is initialized once,\n+ but an automatic compound literal is initialized every time it is reached\n+ in the order of execution. */\n+ int i = 0;\n+ lab:\n+ int *p = &(static int) { 0 };\n+ if (*p != i)\n+ abort ();\n+ i++;\n+ *p = i;\n+ if (i < 5)\n+ goto lab;\n+ i = 0;\n+ lab2:\n+ int *p2 = &(int) { 0 };\n+ if (*p2 != 0)\n+ abort ();\n+ i++;\n+ *p2 = i;\n+ if (i < 5)\n+ goto lab2;\n+ exit (0);\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c2x-complit-3.c b/gcc/testsuite/gcc.dg/c2x-complit-3.c\nnew file mode 100644\nindex 00000000000..c672525ba6f\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c2x-complit-3.c\n@@ -0,0 +1,24 @@\n+/* Test C2x storage class specifiers in compound literals. Thread-local\n+ cases, compilation tests. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c2x -pedantic-errors\" } */\n+/* { dg-require-effective-target tls } */\n+\n+#include \n+\n+/* thread_local is OK at file scope, although of limited use since the\n+ thread-local object and its address are not constant expressions. */\n+size_t st = sizeof (thread_local int) { 1 };\n+size_t sst = sizeof (static thread_local int) { 1 };\n+\n+int *\n+f ()\n+{\n+ return &(static thread_local int) { 2 };\n+}\n+\n+int *\n+g ()\n+{\n+ return &(thread_local static int) { 3 };\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c2x-complit-4.c b/gcc/testsuite/gcc.dg/c2x-complit-4.c\nnew file mode 100644\nindex 00000000000..31d741325d9\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c2x-complit-4.c\n@@ -0,0 +1,60 @@\n+/* Test C2x storage class specifiers in compound literals. Thread-local\n+ cases, execution tests. */\n+/* { dg-do run } */\n+/* { dg-options \"-pthread -std=gnu2x -pedantic-errors\" } */\n+/* { dg-require-effective-target pthread_h } */\n+/* { dg-require-effective-target pthread } */\n+/* { dg-require-effective-target tls_runtime } */\n+/* { dg-add-options tls } */\n+\n+#include \n+\n+extern void abort (void);\n+extern void exit (int);\n+\n+int *\n+thread_addr ()\n+{\n+ return (static thread_local int []) { 1, 2 };\n+}\n+\n+int *volatile p, *volatile q, r;\n+\n+void *\n+thread_fn (void *)\n+{\n+ q = thread_addr ();\n+ if (q[0] != 1 || q[1] != 2)\n+ return NULL;\n+ q[0] = 5;\n+ q[1] = 6;\n+ return &r;\n+}\n+\n+int\n+main ()\n+{\n+ int i;\n+ pthread_t tid;\n+ void *ret;\n+ p = thread_addr ();\n+ if (p[0] != 1 || p[1] != 2)\n+ abort ();\n+ p[0] = 3;\n+ p[1] = 4;\n+ if (p != thread_addr ())\n+ abort ();\n+ i = pthread_create (&tid, NULL, thread_fn, NULL);\n+ if (p != thread_addr ())\n+ abort ();\n+ i = pthread_join (tid, &ret);\n+ if (i != 0)\n+ abort ();\n+ if (ret != &r)\n+ abort ();\n+ if (p != thread_addr ())\n+ abort ();\n+ if (p[0] != 3 || p[1] != 4)\n+ abort ();\n+ exit (0);\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c2x-complit-5.c b/gcc/testsuite/gcc.dg/c2x-complit-5.c\nnew file mode 100644\nindex 00000000000..1eb0f8dd760\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c2x-complit-5.c\n@@ -0,0 +1,52 @@\n+/* Test C2x storage class specifiers in compound literals: invalid code. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c2x -pedantic-errors\" } */\n+\n+int *p = &(register int) { 0 }; /* { dg-error \"file-scope compound literal specifies\" } */\n+\n+int v;\n+\n+void\n+f ()\n+{\n+ int *q = &(thread_local int) { 0 }; /* { dg-error \"compound literal implicitly auto and declared\" } */\n+ int *pc = &(static int) { v }; /* { dg-error \"not constant\" } */\n+ int *pt = &(static thread_local int) { v }; /* { dg-error \"not constant\" } */\n+ &(register int) { 0 }; /* { dg-error \"address of register compound literal requested\" } */\n+ struct s { int a, b; };\n+ &((register struct s) { 1, 2 }.b); /* { dg-error \"address of register compound literal requested\" } */\n+}\n+\n+int *s = &(static static int) { 0 }; /* { dg-error \"duplicate\" } */\n+\n+void\n+g ()\n+{\n+ (void) (register register int) { 0 }; /* { dg-error \"duplicate\" } */\n+ (void) (static static int) { 0 }; /* { dg-error \"duplicate\" } */\n+ (void) (static thread_local thread_local int) { 0 }; /* { dg-error \"duplicate\" } */\n+ (void) (static register int) { 0 }; /* { dg-error \"multiple storage classes in declaration specifiers\" } */\n+ (void) (register static int) { 0 }; /* { dg-error \"multiple storage classes in declaration specifiers\" } */\n+ (void) (register thread_local int) { 0 }; /* { dg-error \"used with\" } */\n+ (void) (thread_local register int) { 0 }; /* { dg-error \"used with\" } */\n+}\n+\n+void\n+h ()\n+{\n+ /* The following cases are not part of the C2x syntax, but are detected\n+ specially by the parser. */\n+ (static int) 0; /* { dg-error \"storage class specifier in cast\" } */\n+ sizeof (static int); /* { dg-error \"storage class specifier in\" } */\n+ alignof (static int); /* { dg-error \"storage class specifier in\" } */\n+}\n+\n+void\n+bad_scspec ()\n+{\n+ /* Storage class specifiers not permitted in compound literals result in a\n+ syntax error. */\n+ (typedef int) { 0 }; /* { dg-error \"expected\" } */\n+ (auto int) { 0 }; /* { dg-error \"expected\" } */\n+ (extern int) { 0 }; /* { dg-error \"expected\" } */\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c2x-complit-6.c b/gcc/testsuite/gcc.dg/c2x-complit-6.c\nnew file mode 100644\nindex 00000000000..23a0bb6420b\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c2x-complit-6.c\n@@ -0,0 +1,7 @@\n+/* Test C2x storage class specifiers in compound literals diagnosed with\n+ -Wc11-c2x-compat. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c2x -Wc11-c2x-compat\" } */\n+\n+int *ps = &(static int) { 1 }; /* { dg-warning \"forbids storage class specifiers in compound literals\" } */\n+int ss = sizeof (static int) { 1 }; /* { dg-warning \"forbids storage class specifiers in compound literals\" } */\ndiff --git a/gcc/testsuite/gcc.dg/c2x-complit-7.c b/gcc/testsuite/gcc.dg/c2x-complit-7.c\nnew file mode 100644\nindex 00000000000..0cd0b86c541\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c2x-complit-7.c\n@@ -0,0 +1,7 @@\n+/* Test C2x storage class specifiers in compound literals diagnosed with\n+ -Wc11-c2x-compat, but not errors with -pedantic-errors. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c2x -Wc11-c2x-compat -pedantic-errors\" } */\n+\n+int *ps = &(static int) { 1 }; /* { dg-warning \"forbids storage class specifiers in compound literals\" } */\n+int ss = sizeof (static int) { 1 }; /* { dg-warning \"forbids storage class specifiers in compound literals\" } */\ndiff --git a/gcc/testsuite/gcc.dg/c90-complit-2.c b/gcc/testsuite/gcc.dg/c90-complit-2.c\nnew file mode 100644\nindex 00000000000..6fcf2a59c43\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c90-complit-2.c\n@@ -0,0 +1,8 @@\n+/* Test C2x storage class specifiers in compound literals not permitted for\n+ C90, but without a duplicate diagnostic, just the diagnostic for compound\n+ literals not being permitted in C90 at all. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c90 -pedantic-errors\" } */\n+\n+int *ps = &(static int) { 1 }; /* { dg-error \"ISO C90 forbids compound literals\" } */\n+int ss = sizeof (static int) { 1 }; /* { dg-error \"ISO C90 forbids compound literals\" } */\ndiff --git a/gcc/testsuite/gcc.dg/gnu2x-complit-1.c b/gcc/testsuite/gcc.dg/gnu2x-complit-1.c\nnew file mode 100644\nindex 00000000000..e9da5ad7958\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu2x-complit-1.c\n@@ -0,0 +1,7 @@\n+/* Test C2x storage class specifiers in compound literals: GNU use of alignof\n+ on objects (tested separately since alignof parsing handles the type name of\n+ compound literals). */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=gnu2x\" } */\n+\n+int a = alignof (static int) { 0 };\ndiff --git a/gcc/testsuite/gcc.dg/gnu2x-complit-2.c b/gcc/testsuite/gcc.dg/gnu2x-complit-2.c\nnew file mode 100644\nindex 00000000000..20cb38fd94e\ 100 33597 100 33445 100 152 628k 2923 --:--:-- --:--:-- --:--:-- 630k n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu2x-complit-2.c\n@@ -0,0 +1,18 @@\n+/* Test C2x storage class specifiers in compound literals. Thread-local\n+ cases, compilation tests, GNU __thread used. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=gnu2x\" } */\n+/* { dg-require-effective-target tls } */\n+\n+#include \n+\n+/* __thread is OK at file scope, although of limited use since the\n+ thread-local object and its address are not constant expressions. */\n+size_t st = sizeof (__thread int) { 1 };\n+size_t sst = sizeof (static __thread int) { 1 };\n+\n+int *\n+f ()\n+{\n+ return &(static __thread int) { 2 };\n+}\n","prefixes":["committed"]}+ exit 1 Build step 'Execute shell' marked build as failure Finished: FAILURE