From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2112.outbound.protection.outlook.com [40.107.237.112]) by sourceware.org (Postfix) with ESMTPS id 54328385800A for ; Thu, 31 Dec 2020 07:00:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 54328385800A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QbawdPMuR73tQGmUpLbElKe4y7rCg7D9lBIvjDHni+P5t65FHAOamcTMvbhxdULN774oZeZNgDzrnsR8m7c5u0CNppYAhb8RUziKK6uJOz/adgYOftAqWpJLONKpRdgszAL7xlnGAIAqtsTkrhCJR3fHWYamWb2aZKwGYQAdcPkQxiBK6VyMSb8xZh3kNwMQj52R3YLa8u1tYa3pTkFWNOrQoksth36JsgGCsiEwJxMdMsKmExoODHaT43LDiM3gB971BKgEZJ9lDFDIfhosdD10MNMkw9I8ies1O5O+880Hu+lcnuXGLVSnnyy85tjwg0/VYkGrMmKINE2Jkxhbag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VZUyj7Qkn6avxgDQogfJOWYU5cxcuvyTt1hUbPOcMOQ=; b=ixhzDArXjZcGj8soN+L/HjMqRpKh1uTJ4BTOJgppO+nTzcHTS/h4Id/Fa8uNyJEAcuDlExNHO6zkgBTSUjk6Q89eQa9sgiw9TNYQ4SL5yyr++FZPNTp2FZhN+6Du4ddyri3C8RJ2tfIaGxnJjkWp4Y6x2rxVkVe8Hb/nVAw9HJNAdOgSi/MmvxROoLGsMn551pbKW0J5SHnA4dd5mXIFV2veoaLM2kHKtwUneBtAXfFMCh7Q5mx/VIRd20ehY7mNxXUtzpB22z0/WWa6xY5owMKSmqt7n5e8ZMHEaJ1HxJoE9T9OcEMHxm+dBf47Ur2PXUGpL3pRN7Hq2u9Hm8uAMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amperecomputing.com; dmarc=pass action=none header.from=amperecomputing.com; dkim=pass header.d=amperecomputing.com; arc=none Received: from BYAPR01MB5464.prod.exchangelabs.com (2603:10b6:a03:129::28) by BYAPR01MB4661.prod.exchangelabs.com (2603:10b6:a03:83::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.31; Thu, 31 Dec 2020 07:00:18 +0000 Received: from BYAPR01MB5464.prod.exchangelabs.com ([fe80::205b:e3d8:df8e:757c]) by BYAPR01MB5464.prod.exchangelabs.com ([fe80::205b:e3d8:df8e:757c%7]) with mapi id 15.20.3700.031; Thu, 31 Dec 2020 07:00:18 +0000 From: Gary Oblock To: "gcc@gcc.gnu.org" Subject: A problem with field decl offsets in newly minted types Thread-Topic: A problem with field decl offsets in newly minted types Thread-Index: AQHW30FQ+Ui1xcwL9UyjJpMCUZB2UQ== Date: Thu, 31 Dec 2020 07:00:18 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [69.181.250.88] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 91085e77-1696-4d62-a264-08d8ad59bb85 x-ms-traffictypediagnostic: BYAPR01MB4661: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: q4cAP0i1Quci5dCPKnhiVReLo0YqCOrx9zqW/GK/OvN1vQDViZaqO4DyrBmPNbquL6NK7SEf3YbJxF2zXDr1nKRo2xwZSRvc9odI8ZJ+FXoPRbEN6ORaFqa+WoOh6eVmSAEeSbZxT3qxIhd9noi80gpRXpWZiW2bY8DKU2ET625+ryqWYbrTjjV7EmkaXSr3o5OGFgvQMLc8/dpKI7MDjoVl/16SkXQB8y/2W5aMHu43/t0yjwSE9gxchys47WHnwm4XxT/0OAy6I8lb5CWPqgKt9sKusNKWnPwTemf9SDKi20CLwQ2+/NlRBh70Rjf24kctCYFsh5HicLRRubzMTjY+8YnIIgMqm+DXIUzUs1K9lMUqbiNoYfrk3/bPBSpbwq6SV7rp9SRTUygyStej/A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR01MB5464.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(136003)(39850400004)(366004)(346002)(66476007)(52536014)(316002)(2906002)(66946007)(8936002)(9686003)(86362001)(5660300002)(33656002)(55016002)(186003)(26005)(66446008)(83380400001)(64756008)(66556008)(478600001)(71200400001)(8676002)(6916009)(76116006)(7696005)(19627405001)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?5LzrqOzn59TtgU+KiaLO7RQIg0iV+5JmKKCl2hAqLl06zJRHTbR0UVMc/0?= =?iso-8859-1?Q?Aq80G4RZJWUlzAh6PEPfCor/IWhBxdUTy7ly1qKPN7Z0cgnxHZ4lErB3mI?= =?iso-8859-1?Q?kNupwv/2cqYkNDbar8AQ9jCAMLxZErYo/XOv6Ck9ql3x2e+yh+MJwj6Td8?= =?iso-8859-1?Q?G0Y6oG0ZoaB1d2Q8cswai1L8uJfRM6FqKc/DAVs41F/2Px7m+ibTBQMObg?= =?iso-8859-1?Q?CTpwacEcSok9fl//KL8iiL4vYyM/KVnp7OALpTrT4XT/C4wa5fD+xfhF7Z?= =?iso-8859-1?Q?PxxLLa+boIFVBLQ3/1Wf75OKt5jkpeDUddwwfHEWw1YhU5rTwBEih+q74w?= =?iso-8859-1?Q?se9dRs3dl8E/6++aqSgaHaiVowNUdJqnjjgDrAwZyep1Z+vOWRiRA1m+Jn?= =?iso-8859-1?Q?fjjloD/8HH2/5+cfNJfDPl43mXiZ5dIzQ0tjermbBzw2FJEk0eSRcVXh4g?= =?iso-8859-1?Q?N7P5O8K3EIIQrjmvlCcNzS4LF4Nt14kY1vePgLngjfPzXDVX/cG8Z91Mdm?= =?iso-8859-1?Q?TtbZoH/ZncgZVSWBAiYK+AgW8fbvgxhqreOVsGMpl3wtL/Uyg4Zz/BwEGY?= =?iso-8859-1?Q?lkKXVwwb/8GtCEb+Md5kJpiF3EWINnWtx3TwqkFzSJDy+n91RPeCX0/QN6?= =?iso-8859-1?Q?a34OZWmo65wjd2cSm44hKEVwtgNmN4u8Kimp8JL4JcJqiwNg4ZAbZssmbR?= =?iso-8859-1?Q?nrNNx9r2qxLGCoqLVa3L5ByJAF7eyMF4pegJoXjKp+GKxFxK5hvn7YWaLq?= =?iso-8859-1?Q?ArNDf+eWen0av4G/8uAQM1FBK0DI4mQBZAoxR/NP+5x2i9FNb/j+mfB4VJ?= =?iso-8859-1?Q?OkU93ZR3zkpade1pb7NFv7yomxguK5v97SJ3ZkzQylWIaVuiJxb4QenoJV?= =?iso-8859-1?Q?gyBzRDKG21NBG7D7x/fVVEBAB/6n9HUgc9Jeg5BmSRH+pJpIar/MxKbUdG?= =?iso-8859-1?Q?IobSsFpBvrrooOLIhMwSvXYmi96qAghlelqoHsijxn9pE7w5P/yLMdGcGW?= =?iso-8859-1?Q?z7cT6/hV+OI6k8qwA=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: amperecomputing.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR01MB5464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91085e77-1696-4d62-a264-08d8ad59bb85 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Dec 2020 07:00:18.1327 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xHDKLOYcRMm+h+XnwEEJypUsxA9t6DL7IY604dh+uqyvmeCjVIqeK3lW90HY9+0qxp4T7nXM65wf3Dgk4cpSgD1tP34kK5rlYlM1CGHuGCA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR01MB4661 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, TXREP, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2020 07:00:23 -0000 I'm having some grief with creating/using some modified types. I problem occurs in tree-ssa-sccvn.c when some code tries to take a DECL_FIELD_OFFSET and unfortuenately gets a null that causes a crash. So, I traced this back the to types I created. Note, the method I used has seemed to be fairly robust (some other engineers in our China group even successfully copied it for thier own optimization.) However, the DECL_FIELD_OFFSET offset is definitely null for the fields which I created in the new versions of the types. Here is what I'm doing. tree type_prime =3D lang_hooks.types.make_type (RECORD_TYPE); const char *base_type_name =3D identifier_to_locale ( IDENTIFIER_POINTER ( TYPE_NAME ( type))); size_t len =3D strlen ( MY_PREFIX) + strlen ( base_type_name); char *rec_name =3D ( char*)alloca ( len + 1); strcpy ( rec_name, MY_PREFIX); strcat ( rec_name, base_type_name); TYPE_NAME ( reorg_type_prime) =3D get_identifier ( rec_name); tree field; tree new_fields =3D NULL; for ( field =3D TYPE_FIELDS ( type); field; field =3D DECL_CHAIN ( fiel= d)) { // Probably useful in creating the new field type. tree old_fld_type =3D TREE_TYPE ( field); // Whatever you want the new field type to be tree new_fld_type =3D ...; tree new_decl =3D build_decl ( DECL_SOURCE_LOCATION (field), FIELD_DECL, DECL_NAME (field), new_fld_type); DECL_CONTEXT ( new_decl) =3D type_prime; layout_decl ( new_decl, 0); DECL_CHAIN ( new_decl) =3D new_fields; new_fields =3D new_decl; } TYPE_FIELDS ( type_prime) =3D nreverse ( new_fields); layout_type ( type_prime); Note, when I change any declaration to have a modified type I run relayout_decl on them. If somebody could please tell what bit I'm missing or what I'm doing wrong I'd really appreciate it. Looking at the code in layout_type, it should be setting the decl field offsets with place_field and I don't have a clue what's going on. Thanks, Gary CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is = for the sole use of the intended recipient(s) and contains information that= is confidential and proprietary to Ampere Computing or its subsidiaries. I= t is to be used solely for the purpose of furthering the parties' business = relationship. Any unauthorized review, copying, or distribution of this ema= il (or any attachments thereto) is strictly prohibited. If you are not the = intended recipient, please contact the sender immediately and permanently d= elete the original and any copies of this email and any attachments thereto= .