Patchwork Add testcase for possible bug in gcc-4_4 ix86 branch

login
register
mail settings
Submitter asharif tools
Date Dec. 8, 2010, 1:32 a.m.
Message ID <AANLkTikBn5rJSmTvTiaufxjbEJnf3GfzkrYcVsJR1LYf@mail.gmail.com>
Download mbox | patch
Permalink /patch/74620/
State New
Headers show

Comments

asharif tools - Dec. 8, 2010, 1:32 a.m.
When compiling a file with the compiler at:
/branches/ix86/gcc-4_4-branch/ with the -fomit-frame-pointer flag, I
encountered a compilation error. The error message read:

error: bp cannot be used in asm here

The reason is this patch here, which H. J. Lu submitted:

http://gcc.gnu.org/viewcvs?view=revision&revision=153780

That patch limits the alignment limit to
MAX_SUPPORTED_STACK_ALIGNMENT. It causes this spurious error about ebp
not being available for use when the source is compiled with
-fomit-frame-pointer. Last time I checked, trunk did not encounter
this error (this is present only in the ix86 4_4 branch as far as I
know). I want to add this testcase to the trunk so it can catch this
failure if it happens again.

Is this OK for trunk?

2010-12-7 Ahmad Sharif <asharif.tools@gmail.com>
  * gcc.target/i386/max-stack-align.c: New.
---
+
Diego Novillo - Dec. 9, 2010, 4:16 p.m.
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.


Diego.
Jakub Jelinek - Dec. 13, 2010, 5 p.m.
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

	Jakub
H.J. Lu - Dec. 13, 2010, 5:08 p.m.
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

Patch

diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/max-stack-align.c b/
new file mode 100644
index 0000000..06e8a5e
--- /dev/null
+++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/max-stack-align.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-fomit-frame-pointer" } */
+
+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" );
+}