impossible constraint in 'asm'

OP #1171692
Rate this post
• ▲ useful
▼ not useful
In the latest "gamma" sample project (20060804c) I am getting an error
when I set optimization to "0".  There is no error when optimization is
set to "s".  It does not make any sense to me:

Compiling C: main.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
-DROM_RUN -DVECTORS_IN_RAM -D__WinARM__ -D__WINARMSUBMDL_AT91SAM7S64__
-O0 -ffunction-sections -fdata-sections -Wall -Wcast-align -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
-Wunused -Wa,-adhlns=main.lst  -I./common -MD -MP -MF .dep/main.o.d
-Wnested-externs  -std=gnu99 main.c -o main.o
./common/swi.h: In function 'do_SWI':
./common/swi.h:19: warning: asm operand 1 probably doesn't match
constraints
./common/swi.h:19: error: impossible constraint in 'asm'
make: *** [main.o] Error 1



- Joe
Guest #1171693
Rate this post
• ▲ useful
▼ not useful
Joe Dupre wrote:
> In the latest "gamma" sample project (20060804c) I am getting an error
> when I set optimization to "0".  There is no error when optimization is
> set to "s".  It does not make any sense to me:
>
> Compiling C: main.c
> arm-elf-gcc -c -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
> -DROM_RUN -DVECTORS_IN_RAM -D__WinARM__ -D__WINARMSUBMDL_AT91SAM7S64__
> -O0 -ffunction-sections -fdata-sections -Wall -Wcast-align -Wimplicit
> -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
> -Wunused -Wa,-adhlns=main.lst  -I./common -MD -MP -MF .dep/main.o.d
> -Wnested-externs  -std=gnu99 main.c -o main.o
> ./common/swi.h: In function 'do_SWI':
> ./common/swi.h:19: warning: asm operand 1 probably doesn't match
> constraints
> ./common/swi.h:19: error: impossible constraint in 'asm'
> make: *** [main.o] Error 1

Thanks for the report. I will try to reproduce the error here. So far I
have only tested with -Os.

Martin Thomas
Guest #1171694
Rate this post
• ▲ useful
▼ not useful
I can reproduce the problem with -O0 here, it works as expected with
-O1. It seems to be a problem with the SWI-Number as parameter ("I"
swi_num) which gets handled differently with optimization enabled. If
you do not nead the SWI-Number as function parameter you might use an
extra function/macro per SWI-Number and hardcode the number in the
inline-assembler-code. The source-code of the macros in the example
show a possible method. I do not know enough about the gcc-internals
maybe you can get a "real" solution by asking in the GNUARM yahoo-group,
the codesourcery support-forum or the gcc-mailing-list.

Martin Thomas

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.