Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 309207 Details for
Bug 412281
cross-avr/gcc-4.5.3-r2 generates bad code
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
The main.c file that demonstrates the bug
main.c (text/plain), 1.01 KB, created by
Christopher Head
on 2012-04-17 04:47:59 UTC
(
hide
)
Description:
The main.c file that demonstrates the bug
Filename:
MIME Type:
Creator:
Christopher Head
Created:
2012-04-17 04:47:59 UTC
Size:
1.01 KB
patch
obsolete
>#define F_CPU 16000000L >#include <inttypes.h> >#include <stdio.h> >#include <avr/io.h> >#include <avr/pgmspace.h> >#include <util/delay.h> > >static int serial_putchar(char ch, FILE *stream __attribute__((__unused__))) { > // Wait until there's space in the hardware buffer to send the byte. > while (!(UCSR0A & _BV(UDRE0))); > > // Queue the byte. > UDR0 = ch; > > return 0; >} > >static FILE serial_fp = FDEV_SETUP_STREAM(&serial_putchar, 0, _FDEV_SETUP_WRITE); > >static void serial_init(void) { > // Set to 9600 baud. > UBRR0 = 103; > UCSR0A = 0; > > // Wait for two byte times (20 / 9600 = 0.002 s) to let the transmit line settle high. > _delay_ms(2); > > // Enable the transmitter. > UCSR0B = _BV(TXEN0); > > // Set up the stream. > stdout = &serial_fp; >} > >uint8_t get_msb(void); >uint8_t get_lsb(void); > >void main(void) __attribute__((__noreturn__)); >void main(void) { > uint8_t msb, lsb; > uint16_t value; > serial_init(); > > for (;;) { > msb = get_msb(); > lsb = get_lsb(); > value = (msb << 8) | lsb; > printf("%" PRIX16 "\r\n", value); > _delay_ms(1000); > } >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 412281
: 309207 |
309209