OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [fwrapv-1.c] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2003 Free Software Foundation.
2
 
3
   Test that the -fwrapv command line option is accepted and disables
4
   "unsafe" optimizations that rely on undefined arithmetic overflow.
5
 
6
   Written by Roger Sayle, 24th March 2003.  */
7
 
8
/* { dg-do run } */
9
/* { dg-options "-O2 -fwrapv" } */
10
 
11
#include <limits.h>
12
 
13
extern void abort ();
14
 
15
int test(int x)
16
{
17
  return (2*x)/2;
18
}
19
 
20
main()
21
{
22
  int x = INT_MAX;
23
 
24
  if (test(x) == x)
25
    abort ();
26
  return 0;
27
}
28
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.