This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add testcase for possible bug in gcc-4_4 ix86 branch


I rolled back my earlier patch containing the testcase quoted below.

I have addressed the following concerns:

1. Initialized the variables.
2. Added a testcase filter to only run on x86_64.
3. Added a valid label to jump to.

This file compiles fine with trunk, but does not compile with the ix86
branch which has a patch that limits the stack alignment.

How does it look?

Here is an updated patch:

Index: gcc/testsuite/gcc.target/i386/max-stack-align.c
===================================================================
--- gcc/testsuite/gcc.target/i386/max-stack-align.c	(revision 0)
+++ gcc/testsuite/gcc.target/i386/max-stack-align.c	(revision 0)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fomit-frame-pointer" } */
+/* { dg-require-effective-target lp64 } */
+
+void foo()
+{
+  int a=0, b=0, c=0, e=0, f=0, g=0, h=0, i=0;
+label:
+	__asm__ volatile( " jb label "
+			  : : "c" (a), "d" (a), "S" (a), "D" (a), "r" (a), "a" (a) ,"r" (a), "r" (a)
+			  : "%""rbp" );
+}
+


On Mon, Dec 13, 2010 at 9:08 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Dec 13, 2010 at 9:00 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, Dec 09, 2010 at 11:16:12AM -0500, Diego Novillo wrote:
>>> On Tue, Dec 7, 2010 at 20:32, asharif tools <asharif.tools@gmail.com> wrote:
>>>
>>> > 2010-12-7 Ahmad Sharif <asharif.tools@gmail.com>
>>> >
>>> > ?* gcc.target/i386/max-stack-align.c: New.
>>>
>>> OK if this passes on trunk.
>>
>> It doesn't on i386, but it has been apparently committed.
>> void foo()
>> {
>> ?int a, b, c, e, f, g, h, i;
>> ? ? ? __asm__ volatile( " jb 1b \n\t"
>> ? ? ? ? ? ? ? ? ? ? ? ? : : "c" (a), "d" (a), "S" (a), "D" (a),
>> ? ? ? ? ? ? ? ? ? ? ? ? "r" (a), "a" (a) ,"r" (a), "r" (a)
>> ? ? ? ? ? ? ? ? ? ? ? ? : "%""rbp" );
>> }
>>
>> %rbp there looks x86-64ish, was the testcase meant just for x86-64 and not
>> i?86? ?Then you'd need to add { target lp64 } requirement.
>>
>> jb 1b when no 1: label is defined is only weird, you shouldn't put anything
>> in there probably, preferrably not garbage as is done. ?The variables are
>> all uninitialized, so the whole testcase is very questionable.
>>
>> And on i386 it expectedly fails with (%esp is reserved, %ebx on some targets
>> that default to -fpic, or if -fpic is used in board flags, then you
>> request another 8 registers (while i386 has just 8 in total)):
>>
>> /usr/src/gcc/gcc/testsuite/gcc.target/i386/max-stack-align.c: In function 'foo':
>> /usr/src/gcc/gcc/testsuite/gcc.target/i386/max-stack-align.c:7:8: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
>> /usr/src/gcc/gcc/testsuite/gcc.target/i386/max-stack-align.c:7:8: error: 'asm' operand has impossible constraints
>>
>
> This is:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46895
>
>
> --
> H.J.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]