{"id":813896,"url":"http://patchwork.ozlabs.org/api/patches/813896/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/AM5PR0701MB2657B2B18AD57CBC087A9B33E46F0@AM5PR0701MB2657.eurprd07.prod.outlook.com/","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":"<AM5PR0701MB2657B2B18AD57CBC087A9B33E46F0@AM5PR0701MB2657.eurprd07.prod.outlook.com>","list_archive_url":null,"date":"2017-09-14T16:33:09","name":"[PATCHv2] Add a -Wcast-align=strict warning","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a52954cb8d1a03d98fbc376cca37710add40b614","submitter":{"id":28385,"url":"http://patchwork.ozlabs.org/api/people/28385/?format=json","name":"Bernd Edlinger","email":"bernd.edlinger@hotmail.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/AM5PR0701MB2657B2B18AD57CBC087A9B33E46F0@AM5PR0701MB2657.eurprd07.prod.outlook.com/mbox/","series":[{"id":3134,"url":"http://patchwork.ozlabs.org/api/series/3134/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=3134","date":"2017-09-14T16:33:09","name":"[PATCHv2] Add a -Wcast-align=strict warning","version":1,"mbox":"http://patchwork.ozlabs.org/series/3134/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813896/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813896/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462152-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462152-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"vRhLzSdM\"; dkim-atps=neutral","sourceware.org; auth=none","gcc.gnu.org;\n\tdkim=none (message not signed) header.d=none; gcc.gnu.org;\n\tdmarc=none action=none header.from=hotmail.de; "],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtPGr508Zz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 02:33:23 +1000 (AEST)","(qmail 42118 invoked by alias); 14 Sep 2017 16:33:15 -0000","(qmail 42105 invoked by uid 89); 14 Sep 2017 16:33:15 -0000","from mail-oln040092069040.outbound.protection.outlook.com (HELO\n\tEUR02-VE1-obe.outbound.protection.outlook.com) (40.92.69.40)\n\tby sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with\n\tESMTP; Thu, 14 Sep 2017 16:33:13 +0000","from VE1EUR02FT045.eop-EUR02.prod.protection.outlook.com\n\t(10.152.12.52) by\n\tVE1EUR02HT108.eop-EUR02.prod.protection.outlook.com\n\t(10.152.13.162) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id\n\t15.20.13.11; Thu, 14 Sep 2017 16:33:10 +0000","from AM5PR0701MB2657.eurprd07.prod.outlook.com (10.152.12.57) by\n\tVE1EUR02FT045.mail.protection.outlook.com (10.152.12.192)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id\n\t15.20.35.14 via Frontend Transport; Thu, 14 Sep 2017 16:33:10 +0000","from AM5PR0701MB2657.eurprd07.prod.outlook.com\n\t([fe80::8c96:1341:5db1:7f8c]) by\n\tAM5PR0701MB2657.eurprd07.prod.outlook.com\n\t([fe80::8c96:1341:5db1:7f8c%18]) with mapi id 15.20.0056.010;\n\tThu, 14 Sep 2017 16:33:10 +0000"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:date:message-id:references:in-reply-to:content-type\n\t:mime-version; q=dns; s=default; b=U0z0Ym/XSKP2yfXKasXyuHzDxVWds\n\tiPwNmdUSQ/yS5S/yPyUFIYSnScnaTxzDxlQlwrqpe8RAqMs98YivUmGSsR1MLqev\n\tDReRkecYyxqmbtF9IpEWSMl1lf0IEOqxFNLNAL+ZBwl2RS32ZXpoBGKwzj7OMOqo\n\t/W43ULNNhXogcc=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:date:message-id:references:in-reply-to:content-type\n\t:mime-version; s=default; bh=Dr226OcUhFY1rvQsVzXSC0G5/g8=; b=vRh\n\tLzSdMOMkcKTdZYwIJNzuY9y7MFjxwusNeepivK69S8kOWQgvkYF9PwvuY+F1JhbU\n\tCeJLLPWdUtcM9pp9378Ou85v8SCFn2EoWlmkouTqxn3r3DVv6NdKNW4RjyVhEUhA\n\tbtE0G6dmXh734njRgoRJiLXZZjHugkIe58h9NlGc=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-15.2 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=H*c:sk:HMHPRHH,\n\tgol","X-HELO":"EUR02-VE1-obe.outbound.protection.outlook.com","From":"Bernd Edlinger <bernd.edlinger@hotmail.de>","To":"\"gcc-patches@gcc.gnu.org\" <gcc-patches@gcc.gnu.org>,\n\tNathan Sidwell\t<nathan@acm.org>, Jason Merrill <jason@redhat.com>,\n\tJoseph Myers\t<joseph@codesourcery.com>,\n\tMarek Polacek <polacek@redhat.com>","Subject":"[PATCHv2] Add a -Wcast-align=strict warning","Date":"Thu, 14 Sep 2017 16:33:09 +0000","Message-ID":"<AM5PR0701MB2657B2B18AD57CBC087A9B33E46F0@AM5PR0701MB2657.eurprd07.prod.outlook.com>","References":"<AM5PR0701MB26571284440889EF6AFF47B8E4910@AM5PR0701MB2657.eurprd07.prod.outlook.com>","In-Reply-To":"<AM5PR0701MB26571284440889EF6AFF47B8E4910@AM5PR0701MB2657.eurprd07.prod.outlook.com>","authentication-results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462152-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"vRhLzSdM\"; dkim-atps=neutral","sourceware.org; auth=none","gcc.gnu.org;\n\tdkim=none (message not signed) header.d=none; gcc.gnu.org;\n\tdmarc=none action=none header.from=hotmail.de; "],"x-incomingtopheadermarker":"OriginalChecksum:21FE42B3341AEB55FB78A2590ADF915D1DC83C3D992911ABE488C1EA73BEF739;\n\tUpperCasedChecksum:36D2E736CC4A3F8DFD3131BDEA8724314D3BD27C8031D0B132F21C8329D5F135;\n\tSizeAsReceived:7297; Count:46","x-ms-exchange-messagesentrepresentingtype":"1","x-tmn":"[5bowgFl9rWHxsdneIws8JacJeXaNXlNh]","x-ms-publictraffictype":"Email","x-microsoft-exchange-diagnostics":"1; VE1EUR02HT108;\n\t6:1eJUnj/wqfA5NonmVhMvzKO53HEHpJz/LqKGOvgq6XOq8fTlJmmZ2ILL5GeLb2XS4h2XuF2vXDtIdItJHD89nCOiWWy06nMxodv3LPbKEln2VehmuWfO++Z8E7A2z6QhjfdnEPyJxuK/IqfiCz1OV5RrjZCT4C8DHhli3sZdgRIuu//RJIAkVv+3kIc0AbYQH1j1kZj1hbom2KQVQn/Jw+0Zw88XZs+YXkZpsRTzRiAxEpezFc84ORgOZNuMzwp8YAu0egHvlAJ5PGKPF7DKROzf3acfGldUpEY3kXGIPo/pHsc6NP2PolOM4CcBdAmL02Ry+mK669Hm9I1nn+MJPw==;\n\t5:OKk8j7Gp8od4gPq09zD0f7Wg8gUTxqqpQwVVdHSZqTPUjdu0uY7yaD3OXu0uiLstT+joDEMQQorUd5y6ctcnQteLjA5DixpTJow5uIbj6bDn0lAJOUZz7clefi4CykHd8eF/e1q/auXE29CK92v6ig==;\n\t24:QPuxoV7Sr4gn9+ChxudTEX5ftIM6M+y2d+Sm9RZ7JgRczAE4uEj9EvoW5SOXycUmlOB7DLBgTOKbqQKGzmDPEpqu8lnwy43s+PGxwg0d2fs=;\n\t7:PeWQKefPf1umb+DlSRqINXsccpYXthwPxVx8Tw2yZktEoSJnAzFoI0QPUBEs7KU6xmLQI+HGR7o1sc/2XHVFpj8lMgQMz85EbgLDQYm0y5kD+wl8AYusGm7GVb9DWe9WikpGWpABglCy6VOipXJGjh+OglNiqbIVv59ErBYjiT5yKt01X6INNJu10wJoG658A3xMQl37gbtGRrevhx5x9AVtSykWBPKqs6yE3+ysBqw=","x-incomingheadercount":"46","x-eopattributedmessage":"0","x-ms-office365-filtering-correlation-id":"0cbd1266-f007-4f7e-414a-08d4fb8e48fc","x-microsoft-antispam":"UriScan:; BCL:0; PCL:0;\n\tRULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);\n\tSRVR:VE1EUR02HT108; ","x-ms-traffictypediagnostic":"VE1EUR02HT108:","x-exchange-antispam-report-test":"UriScan:;","x-exchange-antispam-report-cfa-test":"BCL:0; PCL:0;\n\tRULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031);\n\tSRVR:VE1EUR02HT108; BCL:0; PCL:0;\n\tRULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);\n\tSRVR:VE1EUR02HT108; ","x-forefront-prvs":"0430FA5CB7","x-forefront-antispam-report":"SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT;\n\tSFP:1901; SCL:1; SRVR:VE1EUR02HT108;\n\tH:AM5PR0701MB2657.eurprd07.prod.outlook.com; FPR:; SPF:None;\n\tLANG:; ","spamdiagnosticoutput":"1:99","spamdiagnosticmetadata":"NSPM","Content-Type":"multipart/mixed;\n\tboundary=\"_003_AM5PR0701MB2657B2B18AD57CBC087A9B33E46F0AM5PR0701MB2657_\"","MIME-Version":"1.0","X-OriginatorOrg":"outlook.com","X-MS-Exchange-CrossTenant-originalarrivaltime":"14 Sep 2017 16:33:10.0927\n\t(UTC)","X-MS-Exchange-CrossTenant-fromentityheader":"Internet","X-MS-Exchange-CrossTenant-id":"84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"VE1EUR02HT108"},"content":"On 09/04/17 10:07, Bernd Edlinger wrote:\r\n> Hi,\r\n> \r\n> as you know we have a -Wcast-align warning which works only for\r\n> STRICT_ALIGNMENT targets.  But occasionally it would be nice to be\r\n> able to switch this warning on even for other targets.\r\n> \r\n> Therefore I would like to add a strict version of this option\r\n> which can be invoked with -Wcast-align=strict.  With the only\r\n> difference that it does not depend on STRICT_ALIGNMENT.\r\n> \r\n> I used the code from check_effective_target_non_strict_align\r\n> in target-supports.exp for the first version of the test case,\r\n> where we have this:\r\n> \r\n> return [check_no_compiler_messages non_strict_align assembly {\r\n>       char *y;\r\n>       typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;\r\n>       c *z;\r\n>       void foo(void) { z = (c *) y; }\r\n> } \"-Wcast-align\"]\r\n> \r\n> ... and to my big surprise it did _not_ work for C++ as-is,\r\n> because same_type_p considers differently aligned types identical,\r\n> and therefore cp_build_c_cast tries the conversion first via a\r\n> const_cast which succeeds, but did not emit the cast-align warning\r\n> in this case.\r\n> \r\n> As a work-around I had to check the alignment in build_const_cast_1\r\n> as well.\r\n> \r\n> \r\n> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.\r\n> Is it OK for trunk?\r\n> \r\n\r\nHi,\r\n\r\nas suggested by Joseph, here is an updated patch that\r\nuses min_align_of_type instead of TYPE_ALIGN.\r\n\r\nIs it OK?\r\n\r\n\r\nThanks,\r\nBernd.\ngcc:\n2017-09-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>\n\n\t* common.opt (Wcast-align=strict): New warning option.\n\t* doc/invoke.texi: Document -Wcast-align=strict. \n\nc:\n2017-09-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>\n\n\t* c-typeck.c (build_c_cast): Implement -Wcast-align=strict.\n\ncp:\n2017-09-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>\n\n\t* typeck.c (build_reinterpret_cast_1,\n\tbuild_const_cast_1): Implement -Wcast-align=strict.\n\ntestsuite:\n2017-09-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>\n\n\t* c-c++-common/Wcast-align.c: New test.","diff":"Index: gcc/c/c-typeck.c\r\n===================================================================\r\n--- gcc/c/c-typeck.c\t(revision 251617)\r\n+++ gcc/c/c-typeck.c\t(working copy)\r\n@@ -5578,7 +5578,7 @@ build_c_cast (location_t loc, tree type,\r\n \t}\r\n \r\n       /* Warn about possible alignment problems.  */\r\n-      if (STRICT_ALIGNMENT\r\n+      if ((STRICT_ALIGNMENT || warn_cast_align == 2)\r\n \t  && TREE_CODE (type) == POINTER_TYPE\r\n \t  && TREE_CODE (otype) == POINTER_TYPE\r\n \t  && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE\r\n@@ -5587,7 +5587,8 @@ build_c_cast (location_t loc, tree type,\r\n \t     restriction is unknown.  */\r\n \t  && !(RECORD_OR_UNION_TYPE_P (TREE_TYPE (otype))\r\n \t       && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode)\r\n-\t  && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))\r\n+\t  && min_align_of_type (TREE_TYPE (type))\r\n+\t     > min_align_of_type (TREE_TYPE (otype)))\r\n \twarning_at (loc, OPT_Wcast_align,\r\n \t\t    \"cast increases required alignment of target type\");\r\n \r\nIndex: gcc/common.opt\r\n===================================================================\r\n--- gcc/common.opt\t(revision 251617)\r\n+++ gcc/common.opt\t(working copy)\r\n@@ -564,6 +564,10 @@ Wcast-align\r\n Common Var(warn_cast_align) Warning\r\n Warn about pointer casts which increase alignment.\r\n \r\n+Wcast-align=strict\r\n+Common Var(warn_cast_align,2) Warning\r\n+Warn about pointer casts which increase alignment.\r\n+\r\n Wcpp\r\n Common Var(warn_cpp) Init(1) Warning\r\n Warn when a #warning directive is encountered.\r\nIndex: gcc/cp/typeck.c\r\n===================================================================\r\n--- gcc/cp/typeck.c\t(revision 251617)\r\n+++ gcc/cp/typeck.c\t(working copy)\r\n@@ -7265,15 +7265,16 @@ build_reinterpret_cast_1 (tree type, tre\r\n \t\t\t\t\t       complain))\r\n \treturn error_mark_node;\r\n       /* Warn about possible alignment problems.  */\r\n-      if (STRICT_ALIGNMENT && warn_cast_align\r\n-          && (complain & tf_warning)\r\n+      if ((STRICT_ALIGNMENT || warn_cast_align == 2)\r\n+\t  && (complain & tf_warning)\r\n \t  && !VOID_TYPE_P (type)\r\n \t  && TREE_CODE (TREE_TYPE (intype)) != FUNCTION_TYPE\r\n \t  && COMPLETE_TYPE_P (TREE_TYPE (type))\r\n \t  && COMPLETE_TYPE_P (TREE_TYPE (intype))\r\n-\t  && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (intype)))\r\n+\t  && min_align_of_type (TREE_TYPE (type))\r\n+\t     > min_align_of_type (TREE_TYPE (intype)))\r\n \twarning (OPT_Wcast_align, \"cast from %qH to %qI \"\r\n-                 \"increases required alignment of target type\", intype, type);\r\n+\t\t \"increases required alignment of target type\", intype, type);\r\n \r\n       /* We need to strip nops here, because the front end likes to\r\n \t create (int *)&a for array-to-pointer decay, instead of &a[0].  */\r\n@@ -7447,6 +7448,14 @@ build_const_cast_1 (tree dst_type, tree\r\n \t\t the user is making a potentially unsafe cast.  */\r\n \t      check_for_casting_away_constness (src_type, dst_type,\r\n \t\t\t\t\t\tCAST_EXPR, complain);\r\n+\t      /* ??? comp_ptr_ttypes_const ignores TYPE_ALIGN.  */\r\n+\t      if ((STRICT_ALIGNMENT || warn_cast_align == 2)\r\n+\t\t  && (complain & tf_warning)\r\n+\t\t  && min_align_of_type (TREE_TYPE (dst_type))\r\n+\t\t     > min_align_of_type (TREE_TYPE (src_type)))\r\n+\t\twarning (OPT_Wcast_align, \"cast from %qH to %qI \"\r\n+\t\t\t \"increases required alignment of target type\",\r\n+\t\t\t src_type, dst_type);\r\n \t    }\r\n \t  if (reference_type)\r\n \t    {\r\nIndex: gcc/doc/invoke.texi\r\n===================================================================\r\n--- gcc/doc/invoke.texi\t(revision 251617)\r\n+++ gcc/doc/invoke.texi\t(working copy)\r\n@@ -266,7 +266,8 @@ Objective-C and Objective-C++ Dialects}.\r\n -Wno-attributes  -Wbool-compare  -Wbool-operation @gol\r\n -Wno-builtin-declaration-mismatch @gol\r\n -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol\r\n--Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wcast-align  -Wcast-qual  @gol\r\n+-Wc++-compat  -Wc++11-compat  -Wc++14-compat  @gol\r\n+-Wcast-align  -Wcast-align=strict  -Wcast-qual  @gol\r\n -Wchar-subscripts  -Wchkp  -Wcatch-value  -Wcatch-value=@var{n} @gol\r\n -Wclobbered  -Wcomment  -Wconditionally-supported @gol\r\n -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wdangling-else  -Wdate-time @gol\r\n@@ -5923,6 +5924,12 @@ target is increased.  For example, warn if a @code\r\n an @code{int *} on machines where integers can only be accessed at\r\n two- or four-byte boundaries.\r\n \r\n+@item -Wcast-align=strict\r\n+@opindex Wcast-align=strict\r\n+Warn whenever a pointer is cast such that the required alignment of the\r\n+target is increased.  For example, warn if a @code{char *} is cast to\r\n+an @code{int *} regardless of the target machine.\r\n+\r\n @item -Wwrite-strings\r\n @opindex Wwrite-strings\r\n @opindex Wno-write-strings\r\nIndex: gcc/testsuite/c-c++-common/Wcast-align.c\r\n===================================================================\r\n--- gcc/testsuite/c-c++-common/Wcast-align.c\t(revision 0)\r\n+++ gcc/testsuite/c-c++-common/Wcast-align.c\t(working copy)\r\n@@ -0,0 +1,23 @@\r\n+/* { dg-do compile } */\r\n+/* { dg-options \"-Wcast-align=strict\" } */\r\n+\r\n+typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;\r\n+typedef struct __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)))\r\n+{\r\n+  char x;\r\n+} d;\r\n+\r\n+char *x;\r\n+c *y;\r\n+d *z;\r\n+struct s { long long x; } *p;\r\n+struct t { double x; } *q;\r\n+\r\n+void\r\n+foo (void)\r\n+{\r\n+  y = (c *) x;  /* { dg-warning \"alignment\" } */\r\n+  z = (d *) x;  /* { dg-warning \"alignment\" } */\r\n+  (long long *) p;  /* { dg-bogus \"alignment\" } */\r\n+  (double *) q;     /* { dg-bogus \"alignment\" } */\r\n+}\r\n\r\n","prefixes":["PATCHv2"]}