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/39190] New: gcc 4.4.0 20090214 - Use of "-v" and "--save-temps" alters gcc operation


I am trying to derive a minimal Testcase for a Bug found in:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39186

d# gcc/xgcc -v
Using built-in specs.
Target: x86_64-pc-solaris2.11
Configured with: ../gcc_trunk/configure --build=i386-pc-solaris2.11
--target=x86_64-pc-solaris2.11
--enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --enable-shared
--disable-static --enable-multilib --enable-decimal-float
--with-long-double-128 --with-included-gettext --enable-stage1-checking
--enable-checking=release --with-tune=k8 --with-cpu=k8 --with-arch=k8
--with-gnu-as --with-as=/usr/local/bin/as --with-gnu-ld
--with-ld=/usr/local/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local
--without-ppl
Thread model: posix
gcc version 4.4.0 20090214 (experimental) [trunk revision 144177] (GCC) 


I discovered this Bug while compiling 'crtbegin.c' so the code and
the gcc compile options are entirely derived from these (and not
as minimal a Testcase as I would like).

----------

We will use this "C" source code:

# cat test_gcc_assembler.c
/* FIXME: Including auto-host is incorrect, but until we have
   identified the set of defines that need to go into auto-target.h,
   this will have to do.  */
#include "auto-host.h"
#undef gid_t
#undef pid_t
#undef rlim_t
#undef ssize_t
#undef uid_t
#undef vfork
#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
//#include "tm.h"
#include "unwind-dw2-fde.h"

extern unsigned char __EH_FRAME_BEGIN__[];


/* Used by crtstuff.c to initialize the base of data-relative relocations.
   These are GOT relative on x86, so return the pic register.  */
#ifdef __PIC__
#define CRT_GET_RFIB_DATA(BASE)                 \
  {                                             \
    register void *ebx_ __asm__("ebx");         \
    BASE = ebx_;                                \
  }
#else
#define CRT_GET_RFIB_DATA(BASE)                                         \
  __asm__ ("call\t.LPR%=\n"                                             \
           ".LPR%=:\n\t"                                                \
           "pop{l}\t%0\n\t"                                             \
           /* Due to a GAS bug, this cannot use EAX.  That encodes      \
              smaller than the traditional EBX, which results in the    \
              offset being off by one.  */                              \
           "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"              \
                   "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}"              \
           : "=d"(BASE))
#endif


static void __attribute__((used))
frame_dummy (void)
{
  static struct object object;
#ifdef CRT_GET_RFIB_DATA
  void *tbase, *dbase;
  tbase = 0;
  CRT_GET_RFIB_DATA (dbase);
  if (__register_frame_info_bases)
    __register_frame_info_bases (__EH_FRAME_BEGIN__, &object, tbase, dbase);
#else
  if (__register_frame_info)
    __register_frame_info (__EH_FRAME_BEGIN__, &object);
#endif /* CRT_GET_RFIB_DATA */
}

----------

We will compile two ways:

1. With "-v --save-temps" added to the gcc command line.
2. Without anything added to the gcc command line.


The Original command to compile crtbegin.c (and create crtbegin.s) is:

/usr/share/src/gcc_build/./gcc/xgcc -B/usr/share/src/gcc_build/./gcc/
-B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/
-isystem /usr/local/x86_64-pc-solaris2.11/include -isystem
/usr/local/x86_64-pc-solaris2.11/sys-include -O2 -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS  -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition 
-isystem ./include  -I.
-I/usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc
-I../../gcc_trunk/gcc
-I../../gcc_trunk/gcc//usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc
-I../../gcc_trunk/gcc/../include -I./../intl
-I../../gcc_trunk/gcc/../libcpp/include -I/usr/local/include
-I/usr/local/include -I../../gcc_trunk/gcc/../libdecnumber
-I../../gcc_trunk/gcc/../libdecnumber/dpd -I../libdecnumber   -g -O2 -m64 -g0
-finhibit-size-directive -fno-inline-functions -fno-exceptions
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize
-Dinhibit_libc  \
  -c ../../gcc_trunk/gcc/crtstuff.c -DCRT_BEGIN \
  -o /usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc/crtbegin.o

and it was giving these errors:

/var/tmp//ccqMaidK.s: Assembler messages:
/var/tmp//ccqMaidK.s:91: Error: suffix or operands invalid for `pop'
/var/tmp//ccqMaidK.s:92: Error: Incorrect register `%rdx' used with `l' suffix
gmake[5]: ***
[/usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc/crtbegin.o] Error
1
gmake[5]: Leaving directory `/usr/share/src/gcc_build/gcc'
gmake[4]: *** [gcc-extra-parts] Error 2
gmake[4]: Leaving directory
`/usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc'
gmake[3]: *** [multi-do] Error 1
gmake[3]: Leaving directory
`/usr/share/src/gcc_build/x86_64-pc-solaris2.11/libgcc'
gmake[2]: *** [all-multi] Error 2
gmake[2]: Leaving directory
`/usr/share/src/gcc_build/x86_64-pc-solaris2.11/libgcc'
gmake[1]: *** [all-target-libgcc] Error 2
gmake[1]: Leaving directory `/usr/share/src/gcc_build'
gmake: *** [all] Error 2


So I will use that command on the (almost minimal) Testcase and
add the "-v" and "--save-temps" options in to get different errors.


1. Add "-v --save-temps" and get no errors:

/usr/share/src/gcc_build/./gcc/xgcc -B/usr/share/src/gcc_build/./gcc/
-B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/
-isystem /usr/local/x86_64-pc-solaris2.11/include -isystem
/usr/local/x86_64-pc-solaris2.11/sys-include -O2 -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS  -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition 
-isystem ./include  -I.
-I/usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc
-I../../gcc_trunk/gcc
-I../../gcc_trunk/gcc//usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc
-I../../gcc_trunk/gcc/../include -I./../intl
-I../../gcc_trunk/gcc/../libcpp/include -I/usr/local/include
-I/usr/local/include -I../../gcc_trunk/gcc/../libdecnumber
-I../../gcc_trunk/gcc/../libdecnumber/dpd -I../libdecnumber   -g -O2  -g0
-finhibit-size-directive -fno-inline-functions -fno-exceptions
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize
-Dinhibit_libc -fPIC -c /usr/share/src/gcc_build/test_gcc_assembler.c
-DCRT_BEGIN -fPIC -o /usr/share/src/gcc_build/test_gcc_assembler.s -v
--save-temps  -I/usr/share/src/gcc_trunk/gcc -I/usr/share/src/gcc_build/gcc/ -I
/usr/share/src/gcc_trunk/include/


2. Without anything added to the gcc command line we get errors:

/usr/share/src/gcc_build/./gcc/xgcc -B/usr/share/src/gcc_build/./gcc/
-B/usr/local/x86_64-pc-solaris2.11/bin/ -B/usr/local/x86_64-pc-solaris2.11/lib/
-isystem /usr/local/x86_64-pc-solaris2.11/include -isystem
/usr/local/x86_64-pc-solaris2.11/sys-include -O2 -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS  -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition 
-isystem ./include  -I.
-I/usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc
-I../../gcc_trunk/gcc
-I../../gcc_trunk/gcc//usr/share/src/gcc_build/x86_64-pc-solaris2.11/amd64/libgcc
-I../../gcc_trunk/gcc/../include -I./../intl
-I../../gcc_trunk/gcc/../libcpp/include -I/usr/local/include
-I/usr/local/include -I../../gcc_trunk/gcc/../libdecnumber
-I../../gcc_trunk/gcc/../libdecnumber/dpd -I../libdecnumber   -g -O2  -g0
-finhibit-size-directive -fno-inline-functions -fno-exceptions
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize
-Dinhibit_libc -fPIC -c /usr/share/src/gcc_build/test_gcc_assembler.c
-DCRT_BEGIN -fPIC -o /usr/share/src/gcc_build/test_gcc_assembler.s  
-I/usr/share/src/gcc_trunk/gcc -I/usr/share/src/gcc_build/gcc/ -I
/usr/share/src/gcc_trunk/include/
/usr/share/src/gcc_build/test_gcc_assembler.c: In function ?frame_dummy?:
/usr/share/src/gcc_build/test_gcc_assembler.c:50: warning: the address of
?__register_frame_info_bases? will always evaluate as ?true?
/var/tmp//ccoMaGTh.s: Assembler messages:
/var/tmp//ccoMaGTh.s:8: Error: bad register name `%rbx'
/var/tmp//ccoMaGTh.s:10: Error: bad register name `%rbx'
/var/tmp//ccoMaGTh.s:11: Error: bad register name `%rip)'
/var/tmp//ccoMaGTh.s:12: Error: bad register name `%rbx'
/var/tmp//ccoMaGTh.s:14: Error: bad register name `%rip)'


When I add "-v --save-temps" to the command line the assembler
is fed the correct (32 vs 64 bit) code but when I do not use
those options a small amount of 32 bit code is getting in the
".s" file. If I specifically add in a "-m32" or "-m64" then
it is also OK. It is as though there is no default compile mode
and whether or not that will break is influenced by adding
"-v --save-temps" (which ought not to affect this code).

Rob


-- 
           Summary: gcc 4.4.0 20090214 - Use of "-v" and "--save-temps"
                    alters gcc operation
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com
 GCC build triplet: *
  GCC host triplet: *
GCC target triplet: *


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


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