This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/4840: compiler error as a result of an inline assembly instruction
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/4840: compiler error as a result of an inline assembly instruction
- From: amoroso at gombe dot freeserve dot co dot uk
- Date: 9 Nov 2001 10:43:54 -0000
- Reply-To: amoroso at gombe dot freeserve dot co dot uk
>Number: 4840
>Category: c
>Synopsis: compiler error as a result of an inline assembly instruction
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Nov 09 02:46:13 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Amoroso Gombe
>Release: unknown-1.0
>Organization:
>Environment:
Windows 98
>Description:
I get the following compiler error when I use the code fragment below to attempt to do an A/D converter read [or more accurately, transfer the result of the read to an ordinary c variable from within inline assembler]. As you can see, my problem is trying to copy the value sitting in the working register W into an ordinary C variable so I can export the output to stdout [basically be able to see it in the rest of my program somehow!].
case game_sample:
port_dir(RG, DIR_ALL_INPUTS); /*configure port G as an all input port */
u16_t result asm ("sample") = 0; /* <---This is line 106, that the compiler highlights as the error source, but it's syntactically correct. Declares and Initialises C variable `result', Declares and Initialises assembler variable `sample', */
asm volatile("mov w,#0x0AE
mov 0x053,w /* set adc timer for 100mhz system clock */
mov w,#0x00F
mov 0x052,w /* configure adc - set AVdd as Vref, right justify result, start read */
nop /* give things a chance to settle down */
mov w,0x051 /* place result in working register */
mov sample,w /* transfer result in working register to sample, so that it is visible to C via `result' */
");
break;
}
When I compile the code [it is easily inserted into the template web server cgi script] I get the following error message from the compiler:
/cygdrive/C/starter/app/cgi.c: In function `game_callback':
/cygdrive/C/starter/app/cgi.c: 106: warning: unused variable `result'
/cygdrive/C/starter/app/cgi.c: 106: Internal compiler error in expand _expr, at expr.c:6225 [<---double click and it highlights line 106 pointed to above.]
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make.exe: *** [cgi.o] Error 1
Build failed
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: