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/17302] New: Segmentation Fault in X86_64, ok compiling on 32-bit


Small c program causes seg fault if compiled with gcc 3.3.3-7 and 3.4.1-9 in
64-bit mode, but works fine if compiled in 32-bit mode.

To reproduce:
1. gcc -g test_var5.c
2. gcc -o test5.exe test_var5.o
3. test5.exe

Build environment is AMD64 on Fedora Core 2 (Kernel 2.6.5-1.358).

Test case is as follows:

#include <stdarg.h>
#include <stdlib.h>
#include <signal.h>
#include <ctype.h>
#include <math.h>
                                                                               
                                                                             
#include <stdio.h>
                                                                               
                                                                             
FILE *log_stream_g = 0;
FILE *out_fp;
                                                                               
                                                                             
void io_vprint(fmt, ap)
char *fmt;      /* format string */
va_list ap;
{
    vfprintf(out_fp, fmt, ap);
    vfprintf(log_stream_g, fmt, ap);
                                                                               
                                                                             
}
                                                                               
                                                                             
void io_printf(char *fmt, ...)
{
    va_list args;
                                                                               
                                                                             
    va_start(args, fmt);
                                                                               
                                                                             
    io_vprint(fmt, args);
    va_end(args);
}
                                                                               
                                                                             
main()
{
    FILE *stream = 0;
                                                                               
                                                                             
    out_fp = stdout;
    if ((stream = (FILE *) fopen("temp3.txt", "w")) == 0)
    {
      io_printf("failed to open log\n");
    }
    else
      log_stream_g = stream;
    io_printf("%s%s%s%s%s%s",
             "**********************************************************\n",
             "* Copyright  Systems, Inc. 2000.             *\n",
             "*     All Rights Reserved.       Licensed Software.      *\n",
             "* Confidential and proprietary information which is the  *\n",
             "*      property of Design Systems, Inc.            *\n",
            "**********************************************************\n\n"
            );
}

-- 
           Summary: Segmentation Fault in X86_64, ok compiling on 32-bit
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dafrabbit at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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