From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28728 invoked by alias); 9 Nov 2012 22:00:53 -0000 Received: (qmail 28719 invoked by uid 22791); 9 Nov 2012 22:00:52 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Nov 2012 22:00:43 +0000 Received: from [192.168.178.25] (port-92-195-110-241.dynamic.qsc.de [92.195.110.241]) by mx02.qsc.de (Postfix) with ESMTP id 418DD27741; Fri, 9 Nov 2012 23:00:42 +0100 (CET) Message-ID: <509D7D09.5020405@net-b.de> Date: Fri, 09 Nov 2012 22:00:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2 MIME-Version: 1.0 To: gcc patches Subject: Re: [asan] Patch - fix an ICE in asan.c References: <509D6965.5040405@net-b.de> In-Reply-To: <509D6965.5040405@net-b.de> Content-Type: multipart/mixed; boundary="------------010905070408050100010302" 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 X-SW-Source: 2012-11/txt/msg00791.txt.bz2 This is a multi-part message in MIME format. --------------010905070408050100010302 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1191 Tobias Burnus wrote: > The attached test case ICEs (segfault) both on the asan branch and on > the trunk with Dodji's patches: I found another ICE - this time without a patch. [That's with the patch, which I posted in this thread. Without, one seems to run into the problem I tried to fix with the patch.] [As ASAN is not yet in the trunk, it is not yet suitable for a PR - but on the other hand, I am afraid that I loose it. Thus, I dump it here, which is also not the best place (sorry).] The attached code generates (before ASAN): StringSwitch& StringSwitch ... ... : _2 = &this_1(D)->Str; _3 = StringRef::data (_2); memcmp (S_4(D), _3, 7); return; } And within this basic block, between "_3" and "memcpy", the generated ASAN code is added, which leads to an ICE and 10 times the message. error: control flow in the middle of basic block 7 If one looks at the asan0 dump (after disabling this part of checking), one finds: _52 = _48 & _51; if (_52 != 0) _53 = (unsigned long) _22; The "if" line looks odd as one would expect code of this form: if (_62 != 0) goto ; else goto ; See attachments. Tobias --------------010905070408050100010302 Content-Type: text/plain; charset=UTF-8; name="fail10.ii" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="fail10.ii" Content-length: 757 ZXh0ZXJuICJDIgp7CiAgZXh0ZXJuIGludCBtZW1jbXAgKGNvbnN0IHZvaWQg Kl9fczEsIGNvbnN0IHZvaWQgKl9fczIsCgkJICAgICBsb25nIHVuc2lnbmVk IGludCBfX24pIHRocm93ICgpOwp9CnN0cnVjdCBTdHJpbmdSZWYKewogIGNv bnN0IGNoYXIgKmRhdGEgKCkgY29uc3QgeyB9Cn07CnRlbXBsYXRlIDwgdHlw ZW5hbWUgVCwgdHlwZW5hbWUgUiA9IFQgPiBjbGFzcyBTdHJpbmdTd2l0Y2gK ewogIFN0cmluZ1JlZiBTdHI7CiAgcHVibGljOgogICAgIGV4cGxpY2l0IFN0 cmluZ1N3aXRjaCAoU3RyaW5nUmVmIFN0cik6U3RyIChTdHIpIHsgfQogIHRl bXBsYXRlIDwgdW5zaWduZWQgTiA+IFN0cmluZ1N3aXRjaCAmIENhc2UgKGNv bnN0IGNoYXIgKCZTKVtOXSkKICB7CiAgICBtZW1jbXAgKFMsIFN0ci5kYXRh ICgpLCBOIC0gMSk7CiAgfQogIFIgRGVmYXVsdCAoKSBjb25zdCB7IH0KfTsK CmludCBnZXRJdCAoU3RyaW5nUmVmIE5hbWUpCnsKICByZXR1cm4gU3RyaW5n U3dpdGNoIDwgaW50ID4gKE5hbWUpCiAgICAuQ2FzZSAoInVua25vd24iKQog ICAgLkRlZmF1bHQgKCk7Cn0K --------------010905070408050100010302 Content-Type: text/plain; charset=UTF-8; name="fail10.ii.156t.asan0" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="fail10.ii.156t.asan0" Content-length: 6027 Cjs7IEZ1bmN0aW9uIGNvbnN0IGNoYXIqIFN0cmluZ1JlZjo6ZGF0YSgpIGNv bnN0IChfWk5LOVN0cmluZ1JlZjRkYXRhRXYsIGZ1bmNkZWZfbm89MCwgZGVj bF91aWQ9MjIwMCwgY2dyYXBoX3VpZD0wKQoKY29uc3QgY2hhciogU3RyaW5n UmVmOjpkYXRhKCkgY29uc3QgKGNvbnN0IHN0cnVjdCBTdHJpbmdSZWYgKiBj b25zdCB0aGlzKQp7CiAgPGJiIDI+OgogIEdJTVBMRV9OT1AKICByZXR1cm47 Cgp9CgoKCjs7IEZ1bmN0aW9uIGludCBnZXRJdChTdHJpbmdSZWYpIChfWjVn ZXRJdDlTdHJpbmdSZWYsIGZ1bmNkZWZfbm89NCwgZGVjbF91aWQ9MjIzMCwg Y2dyYXBoX3VpZD0xKQoKaW50IGdldEl0KFN0cmluZ1JlZikgKHN0cnVjdCBT dHJpbmdSZWYgTmFtZSkKewogIHN0cnVjdCBTdHJpbmdTd2l0Y2ggJiBELjIy OTM7CiAgc3RydWN0IFN0cmluZ1JlZiBELjIyOTI7CiAgc3RydWN0IFN0cmlu Z1JlZiBELjIyNzc7CiAgc3RydWN0IFN0cmluZ1N3aXRjaCBELjIyNzg7CiAg aW50IEQuMjI5MTsKICBzdHJ1Y3QgU3RyaW5nU3dpdGNoICYgXzE7CiAgaW50 IF8yOwoKICA8YmIgMj46CiAgU3RyaW5nU3dpdGNoPGludD46OlN0cmluZ1N3 aXRjaCAoJkQuMjI3OCwgRC4yMjkyKTsKICBfMSA9IFN0cmluZ1N3aXRjaDxp bnQ+OjpDYXNlPDh1PiAoJkQuMjI3OCwgInVua25vd24iKTsKICBfMiA9IFN0 cmluZ1N3aXRjaDxpbnQ+OjpEZWZhdWx0IChfMSk7CiAgRC4yMjc4ID17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KICBfX2FzYW5fcmVwb3J0X2xvYWQxIChfNDMpOwoKICA8 YmIgOT46CiAgXzE1ID0gNzsKICBfMTYgPSBfMTUgLSAxOwogIF8xNyA9IFNf NChEKTsKICBfMTggPSBfMTcgKyBfMTY7CiAgXzE5ID0gKHVuc2lnbmVkIGxv bmcpIF8xODsKICBfMjAgPSBfMTkgPj4gMzsKICBfMjEgPSBfMjAgKyAxNzU5 MjE4NjA0NDQxNjsKICBfMjIgPSAoc2lnbmVkIGNoYXIgKikgXzIxOwogIF8y MyA9ICpfMjI7CiAgXzI0ID0gXzIzICE9IDA7CiAgXzI1ID0gXzE5ICYgNzsK ICBfMjYgPSAoc2lnbmVkIGNoYXIpIF8yNTsKICBfMjcgPSBfMjYgPj0gXzIz OwogIF8yOCA9IF8yNCAmIF8yNzsKICBpZiAoXzI4ICE9IDApCiAgICBnb3Rv IDxiYiA2PjsKICBlbHNlCiAgICBnb3RvIDxiYiA1PjsKCiAgPGJiIDY+Ogog IF9fYXNhbl9yZXBvcnRfbG9hZDEgKF8xOSk7CgogIDxiYiA1PjoKICBtZW1j bXAgKFNfNChEKSwgXzMsIDcpOwogIHJldHVybjsKCn0KCgo= --------------010905070408050100010302--