public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17301] New: GCC seg faults on legal C code
@ 2004-09-02 22:44 chris at chrisseaton dot com
  2004-09-02 22:51 ` [Bug c/17301] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: chris at chrisseaton dot com @ 2004-09-02 22:44 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-10-12 11:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-02 22:44 [Bug c/17301] New: GCC seg faults on legal C code chris at chrisseaton dot com
2004-09-02 22:51 ` [Bug c/17301] " pinskia at gcc dot gnu dot org
2004-10-10  0:54 ` [Bug c/17301] ICE on wrong usage of __builtin_stdarg_start pinskia at gcc dot gnu dot org
2004-10-10  1:10 ` cvs-commit at gcc dot gnu dot org
2004-10-10  2:06 ` pinskia at gcc dot gnu dot org
2004-10-10  2:06 ` pinskia at gcc dot gnu dot org
2004-10-11  8:52 ` reichelt at gcc dot gnu dot org
2004-10-11 11:49 ` pinskia at gcc dot gnu dot org
2004-10-12  8:32 ` cvs-commit at gcc dot gnu dot org
2004-10-12 11:42 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).