public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17169] New: optimization bug
@ 2004-08-24 14:39 kminola at eng dot umd dot edu
  2004-08-24 15:28 ` [Bug rtl-optimization/17169] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: kminola at eng dot umd dot edu @ 2004-08-24 14:39 UTC (permalink / raw)
  To: gcc-bugs

/* gcc-3.4.1 optimization bug

  gcc -o foo foo.c -O0 ok
  gcc -o foo foo.c -O1 bug

% ./config.guess
ia64-unknown-linux-gnu
%
% gcc -v
Reading specs from /u/kminola/public/gcc-3.4.1/ia64-Linux/bin/../lib/gcc/ia64-un
known-linux-gnu/3.4.1/specs
Configured with: /u/kminola/public/gcc-3.4.1/src/gcc-3.4.1/configure --enable-la
nguages=c --prefix=/u/kminola/public/gcc-3.4.1/ia64-Linux
Thread model: posix
gcc version 3.4.1
%

does NOT exist in gcc-3.5-20040711 */

#include <stdio.h>

#define GMP_RNDU 2
#define GMP_RNDD 3

int
bar (long a, int rnd_mode)
{
  int signx;
  long b;

  b = a >> 31;
  if (b) {
    signx = -1;
  } else { 
    signx = 1;
  } 

  if (signx < 0 && rnd_mode == GMP_RNDD)
  {
    return -1;
  }
  if (signx > 0 && rnd_mode == GMP_RNDU)
  {
    return 1;
  }
  return 2;
}

int
main (int argc, char *argv[])
{
  int val;
  long a;

  a = 1;
  val = bar (a, GMP_RNDU);
  if (val == 2) {
    printf("bug!\n");
  } else {
    printf("ok!\n");
  }

  return 0;
}

-- 
           Summary: optimization bug
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kminola at eng dot umd dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: ia64-unknown-linux-gnu
  GCC host triplet: ia64-unknown-linux-gnu
GCC target triplet: ia64-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <bug-17169-6067@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2007-05-17 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24 14:39 [Bug c/17169] New: optimization bug kminola at eng dot umd dot edu
2004-08-24 15:28 ` [Bug rtl-optimization/17169] " pinskia at gcc dot gnu dot org
2004-08-26  2:03 ` wilson at gcc dot gnu dot org
2005-01-10 23:43 ` sje at cup dot hp dot com
     [not found] <bug-17169-6067@http.gcc.gnu.org/bugzilla/>
2007-05-17 14:18 ` ebotcazou 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).