public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38245]  New: apparent improper segfault in compiler output
@ 2008-11-24  4:09 regehr at cs dot utah dot edu
  2008-11-24  9:03 ` [Bug rtl-optimization/38245] [4.4 Regression] " jakub at gcc dot gnu dot org
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: regehr at cs dot utah dot edu @ 2008-11-24  4:09 UTC (permalink / raw)
  To: gcc-bugs

This is seen using r142142 on Ubuntu Hardy on x86.

I don't think anything in the source code justifies the segfault.

regehr@john-home:~/volatile/tmp66$ current-gcc -O2 small.c -o small
regehr@john-home:~/volatile/tmp66$ ./small
Segmentation fault
regehr@john-home:~/volatile/tmp66$ current-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --program-prefix=current-
--enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure
--program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr
Thread model: posix
gcc version 4.4.0 20081123 (experimental) (GCC) 

regehr@john-home:~/volatile/tmp66$ cat small.c

#include <stdint.h>
#include <limits.h>

static inline int8_t

safe_sub_int8_t_s_s (int8_t si1, int8_t si2)
{
        if (((si1^si2)
                 & (((si1 ^ ((si1^si2)
                                         & (1 <<
(sizeof(int8_t)*CHAR_BIT-1))))-si2)^si2)) < 0) {
                return si1;
        }
        return si1 - si2;
}

static inline int32_t
safe_div_int32_t_s_s (int32_t si1, int32_t si2)
{
        if ((si2 == 0) || ((si1 == INT_MIN) && (si2 == -1))) {
                return si1;
        }               
        return si1 / si2;
}                       

static inline uint64_t  
safe_mod_uint64_t_u_u (uint64_t ui1, uint64_t ui2)
{                                       
        if (ui2 == 0) return ui1;       
        return ui1 % ui2;               
}                                       

uint8_t g_2;
volatile uint32_t g_9;

int32_t func_3 (void);
int32_t func_3 (void)
{
  return g_2;
}

void func_1 (void);
void func_1 (void)
{
  uint32_t l_10 = 0x084BL;
  if (safe_sub_int8_t_s_s
      ((safe_div_int32_t_s_s
        (0, (safe_mod_uint64_t_u_u (func_3 (), l_10)))), 1))
    {
    }
  else if (g_9)
    {
    }
}

int main (void)
{
  func_1 ();
  return 0;
}


-- 
           Summary: apparent improper segfault in compiler output
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: regehr at cs dot utah dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2009-01-30 22:36 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-24  4:09 [Bug c/38245] New: apparent improper segfault in compiler output regehr at cs dot utah dot edu
2008-11-24  9:03 ` [Bug rtl-optimization/38245] [4.4 Regression] " jakub at gcc dot gnu dot org
2008-11-24  9:12 ` ebotcazou at gcc dot gnu dot org
2008-11-27 17:39 ` jsm28 at gcc dot gnu dot org
2008-11-28 11:25 ` steven at gcc dot gnu dot org
2008-11-28 11:59 ` [Bug rtl-optimization/38245] [4.4 Regression] stack corruption when a call is removed but not the outgoing argument pushes ebotcazou at gcc dot gnu dot org
2008-11-28 14:14 ` jakub at gcc dot gnu dot org
2008-11-28 16:01 ` ebotcazou at gcc dot gnu dot org
2008-12-01 14:38 ` jakub at gcc dot gnu dot org
2008-12-02 17:48 ` jakub at gcc dot gnu dot org
2008-12-02 17:52 ` jakub at gcc dot gnu dot org
2008-12-05 10:29 ` ebotcazou at gcc dot gnu dot org
2008-12-05 11:08 ` jakub at gcc dot gnu dot org
2008-12-11 23:05 ` ebotcazou at gcc dot gnu dot org
2008-12-18 16:59 ` steven at gcc dot gnu dot org
2008-12-18 21:20 ` steven at gcc dot gnu dot org
2008-12-18 22:37 ` steven at gcc dot gnu dot org
2008-12-18 22:59 ` steven at gcc dot gnu dot org
2008-12-19  9:52 ` jakub at gcc dot gnu dot org
2008-12-19 10:43 ` jakub at gcc dot gnu dot org
2008-12-19 14:39 ` jakub at gcc dot gnu dot org
2008-12-20  9:58 ` steven at gcc dot gnu dot org
2009-01-07  6:34 ` ebotcazou at gcc dot gnu dot org
2009-01-12 16:19 ` jakub at gcc dot gnu dot org
2009-01-13 15:37 ` jakub at gcc dot gnu dot org
2009-01-15  8:08 ` jakub at gcc dot gnu dot org
2009-01-15  8:16 ` jakub at gcc dot gnu dot org
2009-01-30 22:36 ` hjl 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).