public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] PR 57362
@ 2013-05-22 23:20 Sriraman Tallam
  2013-05-23  0:14 ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Sriraman Tallam @ 2013-05-22 23:20 UTC (permalink / raw)
  To: GCC Patches

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] PR 57362
  2013-05-22 23:20 [patch] PR 57362 Sriraman Tallam
@ 2013-05-23  0:14 ` H.J. Lu
  2013-06-04 18:55   ` Sriraman Tallam
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2013-05-23  0:14 UTC (permalink / raw)
  To: Sriraman Tallam; +Cc: GCC Patches

On Wed, May 22, 2013 at 4:20 PM, Sriraman Tallam <tmsriram@google.com> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] PR 57362
  2013-05-23  0:14 ` H.J. Lu
@ 2013-06-04 18:55   ` Sriraman Tallam
  2013-06-10 23:10     ` Sriraman Tallam
  2013-07-09  7:09     ` Jason Merrill
  0 siblings, 2 replies; 6+ messages in thread
From: Sriraman Tallam @ 2013-06-04 18:55 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]

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 <hjl.tools@gmail.com> wrote:
> On Wed, May 22, 2013 at 4:20 PM, Sriraman Tallam <tmsriram@google.com> 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.

[-- Attachment #2: pr57362_bug.txt --]
[-- Type: text/plain, Size: 7627 bytes --]

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 <stdio.h>
+    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" } */

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] PR 57362
  2013-06-04 18:55   ` Sriraman Tallam
@ 2013-06-10 23:10     ` Sriraman Tallam
  2013-07-09  7:09     ` Jason Merrill
  1 sibling, 0 replies; 6+ messages in thread
From: Sriraman Tallam @ 2013-06-10 23:10 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

Ping.

On Tue, Jun 4, 2013 at 11:55 AM, Sriraman Tallam <tmsriram@google.com> wrote:
> 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 <hjl.tools@gmail.com> wrote:
>> On Wed, May 22, 2013 at 4:20 PM, Sriraman Tallam <tmsriram@google.com> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] PR 57362
  2013-06-04 18:55   ` Sriraman Tallam
  2013-06-10 23:10     ` Sriraman Tallam
@ 2013-07-09  7:09     ` Jason Merrill
  2013-07-09  7:32       ` Jason Merrill
  1 sibling, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2013-07-09  7:09 UTC (permalink / raw)
  To: Sriraman Tallam, H.J. Lu; +Cc: GCC Patches

On 06/04/2013 02:55 PM, Sriraman Tallam wrote:
>     Sorry for the long delay.  Test case added and patch attached. OK to commit?

OK.

Jason


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] PR 57362
  2013-07-09  7:09     ` Jason Merrill
@ 2013-07-09  7:32       ` Jason Merrill
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Merrill @ 2013-07-09  7:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: GCC Patches

On 06/04/2013 02:55 PM, Sriraman Tallam wrote:
>     Sorry for the long delay.  Test case added and patch attached. OK to commit?

OK.

Jason



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-07-09  7:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-22 23:20 [patch] PR 57362 Sriraman Tallam
2013-05-23  0:14 ` H.J. Lu
2013-06-04 18:55   ` Sriraman Tallam
2013-06-10 23:10     ` Sriraman Tallam
2013-07-09  7:09     ` Jason Merrill
2013-07-09  7:32       ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).