Skip to content

possible integer codegen error #2911

@regehr

Description

@regehr
Bugzilla Link 2539
Resolution FIXED
Resolved on Jul 11, 2008 00:41
Version unspecified
OS Linux
CC @efriedma-quic

Extended Description

From svn 53390 on Ubuntu Feisty on ia32.

[regehr@babel tmp2]$ llvm-gcc -O1 -fwrapv small.c -o small
[regehr@babel tmp2]$ ./small
1
[regehr@babel tmp2]$ llvm-gcc -O2 -fwrapv small.c -o small
[regehr@babel tmp2]$ ./small
0

[regehr@babel tmp2]$ cat small.c
#include <stdint.h>
#include <stdio.h>

static inline unsigned long int
mod_rhs(const long int rhs)
{
if (rhs == 0) return 1;
return rhs;
}

int16_t g_6;
uint8_t g_155;
int8_t g_156;

int32_t func_87 (void);
int32_t func_87 (void)
{
return 1;
}

int32_t func_146 (void);
int32_t func_146 (void)
{
int8_t p_147;
for (p_147 = 0; 1; p_147 -= 1)

if (p_147 >= ((func_87 ()) < (p_147 % mod_rhs (g_155))))
  {
    g_156 = 1;
    for (p_147 = 1; p_147; p_147 += 1)
      return 1;
  }
else
  return 1;  

}

int main (void)
{
func_146 ();
printf ("%d\n", g_156);
return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions