String concatenation, mingw, and the + operator
Lars Andersen
lars@rimfaxe.com
Fri Mar 28 08:40:00 GMT 2003
On Thu, 2003年03月27日 at 19:59, Tom Tromey wrote:
> >>>>> "Lars" == Lars Andersen <lars@rimfaxe.com> writes:
>> Lars> System.out.println("Test");
> Lars> System.out.println(""+0);
> Lars> System.out.println(""+1);
>> Lars> , but this is what i get :
> Lars> Test
>> Lars> 1
>> I get this too :-(.
Just tested on GCC 3.2.1 and GCC 3.3 (latest snapshot) on x86 Linux.
The bug is not present in 3.2.1, but it is present in 3.3 snapshot.
I suspected that +0 get optimized away, like in an integer expression
(a+5+0), where you can safely remove the +0 part without altering the
result. Of course this doesn't work for string concatenations.
But compiling with -O0 -O1 -O2 all yields the same result.
Maybe its something different.
> We've had bugs in this area before. I guess you just found another
> one. Luckily this doesn't seem to happen much in real code.
>> Could you submit a PR for this?
>Will do.
> BTW, if anybody has been itching to fix a compiler bug, this one might
> be a good place to start.
Well, I will give it a shot then.
/Lars Andersen
More information about the Java
mailing list