[Bug c/29968] integer division by zero with optimization

2023-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29968

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|INVALID |DUPLICATE

--- Comment #6 from Andrew Pinski  ---
Dup of bug 41239 in the end which was fixed in GCC 4.5.0.

*** This bug has been marked as a duplicate of bug 41239 ***

[Bug c/29968] integer division by zero with optimization

2023-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29968

--- Comment #5 from Andrew Pinski  ---
(In reply to Vincent Lefèvre from comment #4)
> (In reply to Andreas Schwab from comment #2)
> > Your program is invoking undefined behaviour.  You should not perform the
> > division if the divisor is zero.
> 
> But PR109578 Comment 1 says that side effects should be visible before
> undefined behavior occurs. Thus this bug should be reopened.

Except it can no longer reproduce it so the issue has been fixed a long time
ago.

[Bug c/29968] integer division by zero with optimization

2023-04-20 Thread vincent-gcc at vinc17 dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29968

Vincent Lefèvre  changed:

   What|Removed |Added

 CC||vincent-gcc at vinc17 dot net

--- Comment #4 from Vincent Lefèvre  ---
(In reply to Andreas Schwab from comment #2)
> Your program is invoking undefined behaviour.  You should not perform the
> division if the divisor is zero.

But PR109578 Comment 1 says that side effects should be visible before
undefined behavior occurs. Thus this bug should be reopened.

[Bug c/29968] integer division by zero with optimization

2006-11-28 Thread pinskia at gcc dot gnu dot org


--- Comment #3 from pinskia at gcc dot gnu dot org  2006-11-29 05:59 ---
Just a further note here, divide by 0 is undefined behavior as defined by the C
standard.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

  GCC build triplet|sparc-linux-gnu, sparc-sun- |
   |solaris2.9, sparc64-sun-|
   |solaris2.9  |
   GCC host triplet|sparc-linux-gnu, sparc-sun- |
   |solaris2.9, sparc64-sun-|
   |solaris2.9  |
 GCC target triplet|sparc-linux-gnu, sparc-sun- |sparc*
   |solaris2.9, sparc64-sun-|
   |solaris2.9  |


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



[Bug c/29968] integer division by zero with optimization

2006-11-24 Thread tiamat at komi dot mts dot ru


--- Comment #1 from tiamat at komi dot mts dot ru  2006-11-24 10:31 ---
Created an attachment (id=12681)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12681action=view)
preprocessed file test.i

$ gcc -v -save-temps -O3 test.c
Using built-in specs.
Target: sparc-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-cpu=v8 --with-long-double-128
--enable-checking=release sparc-linux-gnu
Thread model: posix
gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
 /usr/lib/gcc/sparc-linux-gnu/4.1.2/cc1 -E -quiet -v -D__sparc_v8__ test.c
-mcpu=v8 -O3 -fpch-preprocess -o test.i
ignoring nonexistent directory /usr/local/include/sparc-linux-gnu
ignoring nonexistent directory
/usr/lib/gcc/sparc-linux-gnu/4.1.2/../../../../sparc-linux-gnu/include
ignoring nonexistent directory /usr/include/sparc-linux-gnu
#include ... search starts here:
#include ... search starts here:
 /usr/local/include
 /usr/lib/gcc/sparc-linux-gnu/4.1.2/include
 /usr/include
End of search list.
 /usr/lib/gcc/sparc-linux-gnu/4.1.2/cc1 -fpreprocessed test.i -quiet -dumpbase
test.c -mcpu=v8 -auxbase test -O3 -version -fstack-protector -fstack-protector
-o test.s
GNU C version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
(sparc-linux-gnu)
compiled by GNU C version 4.1.2 20060928 (prerelease) (Ubuntu
4.1.1-13ubuntu5).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 98658b34ad66a745f736bec357f1c193
 as -V -Qy -s -32 -relax -o test.o test.s
GNU assembler version 2.17 (sparc-linux-gnu) using BFD version 2.17 Debian
GNU/Linux
 /usr/lib/gcc/sparc-linux-gnu/4.1.2/collect2 --eh-frame-hdr -m elf32_sparc -Y
P,/usr/lib -dynamic-linker /lib/ld-linux.so.2 -relax
/usr/lib/gcc/sparc-linux-gnu/4.1.2/../../../../lib/crt1.o
/usr/lib/gcc/sparc-linux-gnu/4.1.2/../../../../lib/crti.o
/usr/lib/gcc/sparc-linux-gnu/4.1.2/crtbeginS.o
-L/usr/lib/gcc/sparc-linux-gnu/4.1.2 -L/usr/lib/gcc/sparc-linux-gnu/4.1.2
-L/usr/lib/gcc/sparc-linux-gnu/4.1.2/../../../../lib -L/lib/../lib
-L/usr/lib/../lib test.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed /usr/lib/gcc/sparc-linux-gnu/4.1.2/crtend.o
/usr/lib/gcc/sparc-linux-gnu/4.1.2/../../../../lib/crtn.o


-- 


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



[Bug c/29968] integer division by zero with optimization

2006-11-24 Thread schwab at suse dot de


--- Comment #2 from schwab at suse dot de  2006-11-24 10:34 ---
Your program is invoking undefined behaviour.  You should not perform the
division if the divisor is zero.


-- 

schwab at suse dot de changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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