tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] bug?


From: Philippe Ribet
Subject: Re: [Tinycc-devel] bug?
Date: Tue, 19 Aug 2008 22:11:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

John Regehr wrote:

Sorry, I mean it prints "-255".

I'm using tcc-0.9.24 on Ubnutu Linux.

John Regehr



John Regehr wrote:

For the program below, tcc emits a program that prints "255" whereas most compilers would say that the program should print "1".

Of course wrapping the signed scalar p_99 has undefined behavior, so what I am asking is: is tcc intentionally exploiting the undefinedness of the program, or is this a bug?

Thanks,

John Regehr



#include <stdio.h>

int g_254;

void func_97 (signed char p_99);
void func_97 (signed char p_99)
{
  for (; p_99; p_99 -= 1)
    g_254 = p_99;
}

int
main (void)
{
  func_97 (-1);
  printf ("%d\n", g_254);
  return 0;
}



-255 seems strange! Runing it myself, I would say -256. Strange tcc result!

--

            Philippe Ribet


SmartEiffel:
one methodoology, one language,
highest quality kept secret.
Visit http://smarteiffel.loria.fr






reply via email to

[Prev in Thread] Current Thread [Next in Thread]