Bug 30483 - Internal compiler error with inline volatile assembly on AVR
Summary: Internal compiler error with inline volatile assembly on AVR
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.1.3
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2007-01-16 11:18 UTC by Richard Barrington
Modified: 2007-04-17 21:23 UTC (History)
3 users (show)

See Also:
Host: i586-suse-linux
Target: avr-unknown-unknown
Build: i586-suse-linux
Known to work:
Known to fail:
Last reconfirmed: 2007-04-06 19:15:59


Attachments
Preprocessed source of test.c (test.i) (245 bytes, application/octet-stream)
2007-01-16 11:19 UTC, Richard Barrington
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Barrington 2007-01-16 11:18:21 UTC
I was reworking an existing AVR application for C89 compatibility, and while doing so, found an internal compiler error while dealing with inline assembly. I have taken the offending function and trimmed the code to a minimum for a test.

Output is as follows:
test.c: In function 'spi_manual_send_ass_GCC_BUGGY':
test.c:22: internal compiler error: in ptrreg_to_str, at config/avr/avr.c:1009
Please submit a full bug report,
with preprocessed source if appropriate.

The preprocessed source of test.i is appended:

# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
typedef unsigned char uint8_t;

__inline__ uint8_t spi_manual_send_ass_GCC_BUGGY( uint8_t dat )
{
 uint8_t pb;






 __asm__ volatile (
  "\n"
  "nop \n\t"
  "ori %a1,8 \n\t"
  "out 0x05,%a1 \n\t"
  : "=&d" (dat)
  : "d" (pb)
 );

 return pb;
}

int main() {
 uint8_t dat = 0;
 uint8_t result = 0;
 result = spi_manual_send_ass_GCC_BUGGY(dat);
 return 0;
}
Comment 1 Richard Barrington 2007-01-16 11:19:55 UTC
Created attachment 12910 [details]
Preprocessed source of test.c (test.i)
Comment 2 aesok 2007-04-17 21:09:01 UTC
Subject: Bug 30483

Author: aesok
Date: Tue Apr 17 21:08:46 2007
New Revision: 123926

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123926
Log:
	PR target/30483
	* config/avr/avr.c (ptrreg_to_str): Replace gcc_unreachable() with
	error().

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.c

Comment 3 aesok 2007-04-17 21:13:53 UTC
Subject: Bug 30483

Author: aesok
Date: Tue Apr 17 21:13:29 2007
New Revision: 123927

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123927
Log:
	PR target/30483
	* config/avr/avr.c (ptrreg_to_str): Replace gcc_unreachable() with
	error().

Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/avr/avr.c

Comment 4 aesok 2007-04-17 21:19:19 UTC
Subject: Bug 30483

Author: aesok
Date: Tue Apr 17 21:19:06 2007
New Revision: 123929

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123929
Log:
	PR target/30483
	* config/avr/avr.c (ptrreg_to_str): Replace gcc_unreachable() with
	error().

Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/config/avr/avr.c

Comment 5 aesok 2007-04-17 21:23:43 UTC
Fixed in 4.1, 4.2 branch, and HEAD.