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]

[Bug c/17301] New: GCC seg faults on legal C code


GCC seg faults on what I think is legal C code. Shouldn't seg fault even if it
isn't legal.

This is all very tame code. Most of it is just simple structures and function
stubs. The only unsusual thing here is the use of __builtin_stdarg_start et al.
Still shouldn't be seg faulting though...

I'm running Fedora Core 2, which is Linux 2.6, GCC 3.3.3.

gcc -v follows

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)

Preprocessed code follows

When I "gcc -c foo" it seg faults with "internal compiler error".

// /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/cc1 -quiet -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -DIA_32 format.c -quiet -dumpbase
format.c -auxbase-strip format.o -gstabs -std=c99 -ffreestanding -fno-builtin
-fomit-frame-pointer -o - -frandom-seed=0
# 1 "format.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "format.c"




# 1 "format.h" 1







# 1 "stream.h" 1







# 1 "memory.h" 1
# 10 "memory.h"
typedef signed int size_t;

typedef int bool;
# 9 "stream.h" 2
# 18 "stream.h"
typedef struct
{
        int (*seek)(void* handle, int origin, size_t offset);
        size_t (*tell)(void* handle);

        int (*read)(void* handle, void* buffer, size_t size);
        int (*write)(void* handle, void* buffer, size_t size);

        int (*close)(void* handle);
} StreamInterface;

typedef struct
{
        void* handle;
        StreamInterface* interface;
} Stream;

Stream* stream_open(void* handle, StreamInterface* interface);
int stream_seek(Stream* stream, int origin, size_t offset);
size_t stream_tell(Stream* stream);
int stream_read(Stream* stream, void* buffer, size_t size);
int stream_write(Stream* stream, void* buffer, size_t size);
int stream_close(Stream* stream);
# 9 "format.h" 2

int write_format(Stream* stream, char* format, ...);
int write_format_list(Stream* stream, char* format, __builtin_va_list parameters);

int write_int(Stream* stream, int value);
int write_string(Stream* stream, char* string);
# 6 "format.c" 2

int write_format(Stream* stream, char* format, ...)
{
        __builtin_va_list parameters;

        __builtin_stdarg_start(parameters);
        int code = write_format_list(stream, format, parameters);
        __builtin_va_end(parameters);

        return code;
}

int write_format_list(Stream* stream, char* format, __builtin_va_list parameters)
{
        return 0;
}

int write_int(Stream* stream, int value)
{
        return 0;
}

int write_string(Stream* stream, char* string)
{
        return 0;
}

-- 
           Summary: GCC seg faults on legal C code
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at chrisseaton dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17301


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