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/9088: c code aborts with -ftrapv


>Number:         9088
>Category:       c
>Synopsis:       c code aborts with -ftrapv
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 28 16:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stephan Wefing
>Release:        3.2
>Organization:
none
>Environment:
System: Linux kato 2.4.19-64GB-SMP #1 SMP Fri Sep 13 13:15:53 UTC 2002 i686 unknown
Architecture: i686
Linux-Distribution: SuSE Professional 8.1

host: i486-suse-linux-gnu
build: i486-suse-linux-gnu
target: i486-suse-linux-gnu
configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux
>Description:
simple c code using pointer arithmetics aborts if compiled with -ftrapv.
may be related to PR 9097.
>How-To-Repeat:
kato wefing/tmp> cat prog.c

int main(void)
{
   struct s
   {
      int i;
      double x;
   };
   
   struct s a[2];
   struct s *p=a+1;
   int i=p-a;

   return 0;
}

kato wefing/tmp> gcc -o prog prog.c
kato wefing/tmp> ./prog
kato wefing/tmp> gcc -ftrapv -o prog prog.c
kato wefing/tmp> ./prog
Abort (core dumped)
Exit 134
kato wefing/tmp> gcc -g -ftrapv -o prog prog.c
kato wefing/tmp> ./prog
Abort (core dumped)
Exit 134
kato wefing/tmp> gdb ./prog core
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
Core was generated by `./prog'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x4004edf1 in kill () from /lib/libc.so.6
(gdb) w
#0  0x4004edf1 in kill () from /lib/libc.so.6
#1  0x4004ebd8 in raise () from /lib/libc.so.6
#2  0x400504d9 in abort () from /lib/libc.so.6
#3  0x08048452 in __mulvsi3 () at ../../gcc/libgcc2.c:144
#4  0x08048378 in main () at prog.c:11
#5  0x4003d4a2 in __libc_start_main () from /lib/libc.so.6
(gdb) f 4
#4  0x08048378 in main () at prog.c:11
11         int i=p-a;

>Fix:
	


>Release-Note:
>Audit-Trail:
>Unformatted:


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