From patchwork Tue Jun 4 18:55:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 248806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 5D8B42C0082 for ; Wed, 5 Jun 2013 04:55:32 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=v2MGM7c8MAhpkZUddz AJvMtaQzNx4M8Cp1mSy3kjnOYvxYdXhONxVuKELs9vz8lXcJSGqVfjbyeE0Nkmck SCM7NaufHJTDZ86oucOksoG5kDiRkSCNC0QEtcc+Ku3WIXHq3cSHwaRwmHHf4nVE ojBK6ov1bTqbKeUt21EvvSb0Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=Yu4JJDuJ2ytLQJwswhqtEV2Z wjU=; b=TUWY4V6JG0imDRYMZHEp04exkTYF27VkDfoHLmAKIUzu676jKSt3vT2u WhYLGDmgPlinI8d8Gql/Sf07WwT8dqfHYUnLmQjN1vxqyUazjMVBHRiowbqdg4zx Ogiz3tYsVkywfPN/V06ASMnyj5UEwg3t64gUTZrVWyYDGHOrFuQ= Received: (qmail 12065 invoked by alias); 4 Jun 2013 18:55:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 12043 invoked by uid 89); 4 Jun 2013 18:55:24 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ie0-f171.google.com (HELO mail-ie0-f171.google.com) (209.85.223.171) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 04 Jun 2013 18:55:22 +0000 Received: by mail-ie0-f171.google.com with SMTP id s9so1280469iec.16 for ; Tue, 04 Jun 2013 11:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=vmbQNjoHG7PAyFuNAY52VKmI+LHkTN+GxrOelfG+yBg=; b=Ak8N0VCLdMl8Dks8PTNgqSayFPFwmEfAyKtLfA+52+TytzAzeK/iKQNFlZsi8VqSHn gx3dSJ5hFVBtIgj3/faoOvFSbALvI5uqhWcRkVCl5clHIFaJ7Xm/1Ql/kodGeJFC84z0 p75qxLoDaEL+DvHSN1SN7v88cn6yAL//YKxZybWK/9CxozEGOg6I/ZR1jRSWd2Og0AQD kjvHkdLIC5DZmMm4cTu0UiuyD7yV8Wq9Z65nPkSuyt2mHhMhoT9ph0z/HrmBNxWWaHiH az5hoydKlyztbzD1dzcJxh8BG0c9Aatq8byFfwrdoqU3iDdNUbEFPdM2HI0tCsgwIdhG xB3w== MIME-Version: 1.0 X-Received: by 10.50.107.106 with SMTP id hb10mr1705762igb.25.1370372121428; Tue, 04 Jun 2013 11:55:21 -0700 (PDT) Received: by 10.231.210.195 with HTTP; Tue, 4 Jun 2013 11:55:21 -0700 (PDT) In-Reply-To: References: Date: Tue, 4 Jun 2013 11:55:21 -0700 Message-ID: Subject: Re: [patch] PR 57362 From: Sriraman Tallam To: "H.J. Lu" Cc: GCC Patches X-Gm-Message-State: ALoCoQmKDD9gFmbmxH2Eku/gM6SIjQkpGIcCoEXFFffNWxTcTcXSZGv2r0j5NSZ3D05WuL0cYy/0UaLCxBC6K52yuljWkVY1QxT8gDVVB5JxYsRodBLVfuV1vJF4a0lAaMaw3exF+zNjSCc3HKHsWojH2LqVLX54b9nc0HzlGjqteItdRQT3WBFwlh5H/BvcQBuslbGT4fKU6/xL7K4FxYdzgwd2b/QAlw== X-Virus-Found: No X-IsSubscribed: yes Hi, Sorry for the long delay. Test case added and patch attached. OK to commit? Thanks Sri On Wed, May 22, 2013 at 5:14 PM, H.J. Lu wrote: > On Wed, May 22, 2013 at 4:20 PM, Sriraman Tallam wrote: >> Hi, >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57362 >> >> This ICE reported here happens because the array storing the >> function versions that should be processed is not indexed correctly. >> This patch fixes this. This only happens when some versions cannot be >> dispatched because a dispatcher for that is not available or is an >> invalid target. >> >> >> Is this alright? >> >> Thanks, >> Sri >> >> PR 57362 >> * config/i386/i386.c (dispatch_function_versions): Use >> actual_versions to index into >> function_version_info. >> >> Index: config/i386/i386.c >> =================================================================== >> --- config/i386/i386.c (revision 199219) >> +++ config/i386/i386.c (working copy) >> @@ -29061,10 +29061,10 @@ dispatch_function_versions (tree dispatch_decl, >> if (predicate_chain == NULL_TREE) >> continue; >> >> + function_version_info [actual_versions].version_decl = version_decl; >> + function_version_info [actual_versions].predicate_chain = >> predicate_chain; >> + function_version_info [actual_versions].dispatch_priority = priority; >> actual_versions++; >> - function_version_info [ix - 1].version_decl = version_decl; >> - function_version_info [ix - 1].predicate_chain = predicate_chain; >> - function_version_info [ix - 1].dispatch_priority = priority; >> } >> >> /* Sort the versions according to descending order of dispatch priority. The > > You should also add the testcase in PR57362. > > -- > H.J. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 199662) +++ config/i386/i386.c (working copy) @@ -29357,10 +29357,11 @@ dispatch_function_versions (tree dispatch_decl, if (predicate_chain == NULL_TREE) continue; + function_version_info [actual_versions].version_decl = version_decl; + function_version_info [actual_versions].predicate_chain + = predicate_chain; + function_version_info [actual_versions].dispatch_priority = priority; actual_versions++; - function_version_info [ix - 1].version_decl = version_decl; - function_version_info [ix - 1].predicate_chain = predicate_chain; - function_version_info [ix - 1].dispatch_priority = priority; } /* Sort the versions according to descending order of dispatch priority. The Index: testsuite/g++.dg/ext/pr57362.C =================================================================== --- testsuite/g++.dg/ext/pr57362.C (revision 0) +++ testsuite/g++.dg/ext/pr57362.C (revision 0) @@ -0,0 +1,199 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-ifunc "" } */ + +__attribute__((target("default"))) +int foo(void) { return 1; } +__attribute__((target("128bit-long-double"))) +int foo(void) { return 1; } +__attribute__((target("80387"))) +int foo(void) { return 1; } +__attribute__((target("96bit-long-double"))) +int foo(void) { return 1; } +__attribute__((target("long-double-80"))) +int foo(void) { return 1; } +__attribute__((target("long-double-64"))) +int foo(void) { return 1; } +__attribute__((target("accumulate-outgoing-args"))) +int foo(void) { return 1; } +__attribute__((target("align-double"))) +int foo(void) { return 1; } +__attribute__((target("align-stringops"))) +int foo(void) { return 1; } +__attribute__((target("fancy-math-387"))) +int foo(void) { return 1; } +__attribute__((target("force-drap"))) +int foo(void) { return 1; } +__attribute__((target("fp-ret-in-387"))) +int foo(void) { return 1; } +__attribute__((target("hard-float"))) +int foo(void) { return 1; } +__attribute__((target("ieee-fp"))) +int foo(void) { return 1; } +__attribute__((target("inline-all-stringops"))) +int foo(void) { return 1; } +__attribute__((target("inline-stringops-dynamically"))) +int foo(void) { return 1; } +__attribute__((target("intel-syntax"))) +int foo(void) { return 1; } +__attribute__((target("ms-bitfields"))) +int foo(void) { return 1; } +__attribute__((target("no-align-stringops"))) +int foo(void) { return 1; } +__attribute__((target("no-fancy-math-387"))) +int foo(void) { return 1; } +__attribute__((target("no-push-args"))) +int foo(void) { return 1; } +__attribute__((target("no-red-zone"))) +int foo(void) { return 1; } +__attribute__((target("omit-leaf-frame-pointer"))) +int foo(void) { return 1; } +__attribute__((target("pc32"))) +int foo(void) { return 1; } +__attribute__((target("pc64"))) +int foo(void) { return 1; } +__attribute__((target("pc80"))) +int foo(void) { return 1; } +__attribute__((target("push-args"))) +int foo(void) { return 1; } +__attribute__((target("red-zone"))) +int foo(void) { return 1; } +__attribute__((target("rtd"))) +int foo(void) { return 1; } +__attribute__((target("soft-float"))) +int foo(void) { return 1; } +__attribute__((target("sseregparm"))) +int foo(void) { return 1; } +__attribute__((target("stackrealign"))) +int foo(void) { return 1; } +__attribute__((target("stack-arg-probe"))) +int foo(void) { return 1; } +__attribute__((target("tls-direct-seg-refs"))) +int foo(void) { return 1; } +__attribute__((target("vect8-ret-in-mem"))) +int foo(void) { return 1; } +__attribute__((target("recip"))) +int foo(void) { return 1; } +__attribute__((target("cld"))) +int foo(void) { return 1; } +__attribute__((target("vzeroupper"))) +int foo(void) { return 1; } +__attribute__((target("dispatch-scheduler"))) +int foo(void) { return 1; } +__attribute__((target("prefer-avx128"))) +int foo(void) { return 1; } +__attribute__((target("32"))) +int foo(void) { return 1; } +__attribute__((target("64"))) +int foo(void) { return 1; } +__attribute__((target("x32"))) +int foo(void) { return 1; } +__attribute__((target("mmx"))) +int foo(void) { return 1; } +__attribute__((target("3dnow"))) +int foo(void) { return 1; } +__attribute__((target("3dnowa"))) +int foo(void) { return 1; } +__attribute__((target("sse"))) +int foo(void) { return 1; } +__attribute__((target("sse2"))) +int foo(void) { return 1; } +__attribute__((target("sse3"))) +int foo(void) { return 1; } +__attribute__((target("ssse3"))) +int foo(void) { return 1; } +__attribute__((target("sse4.1"))) +int foo(void) { return 1; } +__attribute__((target("sse4.2"))) +int foo(void) { return 1; } +__attribute__((target("sse4"))) +int foo(void) { return 1; } +__attribute__((target("no-sse4"))) +int foo(void) { return 1; } +__attribute__((target("sse5"))) +int foo(void) { return 1; } +__attribute__((target("avx"))) +int foo(void) { return 1; } +__attribute__((target("avx2"))) +int foo(void) { return 1; } +__attribute__((target("fma"))) +int foo(void) { return 1; } +__attribute__((target("sse4a"))) +int foo(void) { return 1; } +__attribute__((target("fma4"))) +int foo(void) { return 1; } +__attribute__((target("xop"))) +int foo(void) { return 1; } +__attribute__((target("lwp"))) +int foo(void) { return 1; } +__attribute__((target("abm"))) +int foo(void) { return 1; } +__attribute__((target("popcnt"))) +int foo(void) { return 1; } +__attribute__((target("bmi"))) +int foo(void) { return 1; } +__attribute__((target("bmi2"))) +int foo(void) { return 1; } +__attribute__((target("lzcnt"))) +int foo(void) { return 1; } +__attribute__((target("hle"))) +int foo(void) { return 1; } +__attribute__((target("rdseed"))) +int foo(void) { return 1; } +__attribute__((target("prfchw"))) +int foo(void) { return 1; } +__attribute__((target("adx"))) +int foo(void) { return 1; } +__attribute__((target("fxsr"))) +int foo(void) { return 1; } +__attribute__((target("xsave"))) +int foo(void) { return 1; } +__attribute__((target("xsaveopt"))) +int foo(void) { return 1; } +__attribute__((target("tbm"))) +int foo(void) { return 1; } +__attribute__((target("cx16"))) +int foo(void) { return 1; } +__attribute__((target("sahf"))) +int foo(void) { return 1; } +__attribute__((target("movbe"))) +int foo(void) { return 1; } +__attribute__((target("crc32"))) +int foo(void) { return 1; } +__attribute__((target("aes"))) +int foo(void) { return 1; } +__attribute__((target("pclmul"))) +int foo(void) { return 1; } +__attribute__((target("sse2avx"))) +int foo(void) { return 1; } +__attribute__((target("fsgsbase"))) +int foo(void) { return 1; } +__attribute__((target("rdrnd"))) +int foo(void) { return 1; } +__attribute__((target("f16c"))) +int foo(void) { return 1; } +__attribute__((target("fentry"))) +int foo(void) { return 1; } +__attribute__((target("8bit-idiv"))) +int foo(void) { return 1; } +__attribute__((target("avx256-split-unaligned-load"))) +int foo(void) { return 1; } +__attribute__((target("avx256-split-unaligned-store"))) +int foo(void) { return 1; } +__attribute__((target("rtm"))) +int foo(void) { return 1; } +//--------------- + +#include + int main (void) + { + int result; + result = foo(); + printf("Result is %d\n", result); + return result; + } + +/* { dg-prune-output "attribute.* is unknown" } */ +/* { dg-prune-output "redefinition of int foo" } */ +/* { dg-prune-output "previous declaration of int foo" } */ +/* { dg-prune-output "int foo.* previously defined here" } */ +/* { dg-prune-output "No dispatcher found for" } */