This is the mail archive of the gcc-bugs@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]

target/3218: ARM/Thumb: Illegal byte-oriented stack instructions



>Number:         3218
>Category:       target
>Synopsis:       ARM/Thumb: Illegal byte-oriented stack instructions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 18 01:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Rauscher
>Release:        3.0 20010528 (prerelease)
>Organization:
LoyTec electronics
>Environment:
System: Linux lexx 2.2.17 #1 Thu Oct 12 11:50:54 CEST 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: arm-rtems-elf
configured with: ./configure --prefix=/prj/rtems/test --target=arm-rtems-elf --enable-languages=c --with-newlib
>Description:
	Under some cirumstances (after some byte-oriented stack access), the compiler
        generates sp-relative strb instructions, which are not supported by 
        the Thumb instruction set. When the code is less complex than the example
        below, the sp register gets copied into an accessible low register before
        accessing the stack, so the problem only occurs in more complex functions.
        Switches: -mthumb -mbig-endian -mthumb-interwork -O3
>How-To-Repeat:
Preprocessor output:
# 16 "strb.c"
typedef struct
{
  char x1, x2, x3, x4, x5, *x6;
} s1;

typedef struct
{
  char x, y[8];
} s2;

extern int *a1;
extern s2 *a2;
void f1(void *p1, void *p2);

void f2(int n, char *p, int *out)
{
  s1 in;

  in.x1 = p[0];
  in.x2 = p[1];
  in.x3 = p[2];
  in.x4 = p[3];
  in.x5 = p[4];
  in.x6 = p;

  if(!in.x1)
  {
    f1(&a2[n].x, in.x1);
    f1(&a2[n].x, &a1[n]);
    if (n) *out = 0;
    if (in.x1) *out = 0;
  }
}
>Fix:
	Probably the thumb_movqi_insn should not contain the 
        ldrb/strb/ldrh/strh instructions in conjunction with
        the high registers for thumb mode.
>Release-Note:
>Audit-Trail:
>Unformatted:


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