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]
Other format: [Raw text]

c/9100: illegal binary constant causes gcc to seg fault


>Number:         9100
>Category:       c
>Synopsis:       illegal binary constant causes gcc to seg fault
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 29 15:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     sander_pool@pobox.com
>Release:        3.3
>Organization:
>Environment:
Win32(Win2k), WinAVR release of AVR-gcc.
>Description:
I used an illegal binary constant declaration (0b111), this caused avr-gcc to crash:

"-------- begin --------"
avr-gcc --version
avr-gcc (GCC) 3.3 20021209 (experimental)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

"Size before:"
   text	   data	    bss	    dec	    hex	filename
      0	    390	      0	    390	    186	pin_test.hex
avr-gcc -c -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -save-temps -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=pin_test.lst -mmcu=atmega128 -I. pin_test.c -o pin_test.o
pin_test.c:40:61: invalid suffix "b11111000" on integer constant
pin_test.c: In function `__vector_16':
pin_test.c:40: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make: *** [pin_test.o] Error 1

C:\coding\sources\avr\pin_test>


I will also report this on the avr-gcc forum but it seems to be a generic gcc problem (it should never crash).
>How-To-Repeat:
Compile the attached file with the options as shown in the description. Observe the error message.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="pin_test.i"
Content-Disposition: inline; filename="pin_test.i"

# 1 "pin_test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "pin_test.c"
# 13 "pin_test.c"
# 1 "c:/winavr/avr/include/avr/io.h" 1 3
# 75 "c:/winavr/avr/include/avr/io.h" 3
# 1 "c:/winavr/avr/include/avr/iom128.h" 1 3
# 46 "c:/winavr/avr/include/avr/iom128.h" 3
# 1 "c:/winavr/avr/include/avr/sfr_defs.h" 1 3
# 47 "c:/winavr/avr/include/avr/iom128.h" 2 3
# 76 "c:/winavr/avr/include/avr/io.h" 2 3
# 14 "pin_test.c" 2
# 1 "c:/winavr/avr/include/avr/interrupt.h" 1 3
# 101 "c:/winavr/avr/include/avr/interrupt.h" 3
extern inline void enable_external_int (unsigned char ints)
{

  ((*(volatile unsigned char *)(((unsigned int) &((*(volatile unsigned char *)((0x39) + 0x20)))))) = (ints));





}
# 119 "c:/winavr/avr/include/avr/interrupt.h" 3
extern inline void timer_enable_int (unsigned char ints)
{

  ((*(volatile unsigned char *)(((unsigned int) &((*(volatile unsigned char *)((0x37) + 0x20)))))) = (ints));

}
# 15 "pin_test.c" 2
# 1 "c:/winavr/avr/include/avr/signal.h" 1 3
# 16 "pin_test.c" 2

# 1 "../include/m128_master.h" 1
# 18 "pin_test.c" 2


volatile unsigned char led;
volatile unsigned char blink;
# 30 "pin_test.c"
void __vector_16 (void) __attribute__ ((signal)); void __vector_16 (void)
{
# 40 "pin_test.c"
        if (((*(volatile unsigned char *)((0x13) + 0x20)) & 0b11111000) == 0) {
                if (blink) {
                        (*(volatile unsigned char *)(0x62)) = 0;
                } else {

                        (*(volatile unsigned char *)(0x62)) = (1<<((*(volatile unsigned char *)((0x13) + 0x20)) & 00111));
                }
        }
        if (((*(volatile unsigned char *)((0x13) + 0x20)) & 0b1000) != 0) {
                if (blink) {
                        (*(volatile unsigned char *)((0x18) + 0x20)) = 0;
                } else {
                        (*(volatile unsigned char *)((0x18) + 0x20)) = (1<<((*(volatile unsigned char *)((0x13) + 0x20)) & 0b111));
                }
        }
        if (((*(volatile unsigned char *)((0x13) + 0x20)) & 0b10000) != 0) {
                if (blink) {
                        (*(volatile unsigned char *)((0x03) + 0x20)) = 0;
                } else {
                        if ((*(volatile unsigned char *)((0x13) + 0x20)) > 2) {

                                (*(volatile unsigned char *)((0x03) + 0x20)) = (1<<((*(volatile unsigned char *)((0x13) + 0x20)) & 0b111));
                        }
                }
        }

        (*(volatile unsigned char *)((0x12) + 0x20)) = ~led;
        led <<= 1;

        if (!led)
                led = (1<<6);
        (*(volatile unsigned char *)((0x32) + 0x20)) = 0;

        if (blink) {
                blink = 0;
        } else {
                blink =1;
        }

}


int main(void)
{
        (*(volatile unsigned char *)((0x11) + 0x20)) = 0b1100000;
        (*(volatile unsigned char *)(0x61)) = 0xff;
        (*(volatile unsigned char *)((0x17) + 0x20)) = 0xff;
        (*(volatile unsigned char *)((0x02) + 0x20)) = 0xff;
        (*(volatile unsigned char *)((0x12) + 0x20)) = 0x00;
        (*(volatile unsigned char *)((0x18) + 0x20)) = 0x00;
        (*(volatile unsigned char *)((0x14) + 0x20)) = 0;
        (*(volatile unsigned char *)((0x15) + 0x20)) = 0xff;

        blink = 0;



        (*(volatile unsigned char *)((0x30) + 0x20)) = (1 << 3);

        (*(volatile unsigned char *)((0x32) + 0x20)) = 0;
        (*(volatile unsigned char *)((0x33) + 0x20)) = 5;
        (*(volatile unsigned char *)((0x37) + 0x20)) = (1 << 0);

        __asm__ __volatile__ ("sei" ::);
        for (;;) {
        }
}


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