public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java
@ 2006-06-23 16:44 amylaar at gcc dot gnu dot org
2006-06-23 18:00 ` [Bug tree-optimization/28144] " amylaar at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-06-23 16:44 UTC (permalink / raw)
To: gcc-bugs
According to:
http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363
java conversions of floating point values to integer types smaller than int
should be done by converting to integer first, and then from int to the target
type. While the former conversion is done with saturation, the latter is
done by discarding the most significant bits.
i.e. 65536.0 converted to char is 0 .
However, fold_convert_const_int_from_real will compute 65535 instead.
--
Summary: floating point constant -> byte/char/short conversion is
wrong for java
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amylaar at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28144
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/28144] floating point constant -> byte/char/short conversion is wrong for java
2006-06-23 16:44 [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java amylaar at gcc dot gnu dot org
@ 2006-06-23 18:00 ` amylaar at gcc dot gnu dot org
2006-06-26 11:19 ` aph at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-06-23 18:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from amylaar at gcc dot gnu dot org 2006-06-23 17:55 -------
Created an attachment (id=11733)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11733&action=view)
patch
I'm currently testing this patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28144
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/28144] floating point constant -> byte/char/short conversion is wrong for java
2006-06-23 16:44 [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java amylaar at gcc dot gnu dot org
2006-06-23 18:00 ` [Bug tree-optimization/28144] " amylaar at gcc dot gnu dot org
@ 2006-06-26 11:19 ` aph at gcc dot gnu dot org
2006-06-26 12:27 ` joern dot rennecke at st dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: aph at gcc dot gnu dot org @ 2006-06-26 11:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from aph at gcc dot gnu dot org 2006-06-26 09:45 -------
Thank you for this patch.
It seems to be a patch for the core constant folding code. Would it not be
more
appropriate to do this in the Java front end's function convert() (in
java/typeck.c) ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28144
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/28144] floating point constant -> byte/char/short conversion is wrong for java
2006-06-23 16:44 [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java amylaar at gcc dot gnu dot org
2006-06-23 18:00 ` [Bug tree-optimization/28144] " amylaar at gcc dot gnu dot org
2006-06-26 11:19 ` aph at gcc dot gnu dot org
@ 2006-06-26 12:27 ` joern dot rennecke at st dot com
2006-06-29 21:45 ` patchapp at dberlin dot org
2006-07-17 16:05 ` patchapp at dberlin dot org
4 siblings, 0 replies; 6+ messages in thread
From: joern dot rennecke at st dot com @ 2006-06-26 12:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from joern dot rennecke at st dot com 2006-06-26 11:19 -------
Subject: Re: floating point constant -> byte/char/short conversion is wrong
for java
aph at gcc dot gnu dot org wrote:
>------- Comment #2 from aph at gcc dot gnu dot org 2006-06-26 09:45 -------
>Thank you for this patch.
>
>It seems to be a patch for the core constant folding code. Would it not be
>more
>appropriate to do this in the Java front end's function convert() (in
>java/typeck.c) ?
>
>
The current implementation has been patched allegedly for the benefit of
java, with the side effect of
giving different results between -O0 and -O1 for some (unspecified or
undefined) conversions for C/C++.
Having user bugs masked by -O0 makes debugging harder, so this is a
quality of implementation issue.
The proposed patch would also address this issue.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28144
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/28144] floating point constant -> byte/char/short conversion is wrong for java
2006-06-23 16:44 [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java amylaar at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-06-26 12:27 ` joern dot rennecke at st dot com
@ 2006-06-29 21:45 ` patchapp at dberlin dot org
2006-07-17 16:05 ` patchapp at dberlin dot org
4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2006-06-29 21:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from patchapp at dberlin dot org 2006-06-29 21:44 -------
Subject: Bug number PR tree-optimization/28144
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01402.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28144
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/28144] floating point constant -> byte/char/short conversion is wrong for java
2006-06-23 16:44 [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java amylaar at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-06-29 21:45 ` patchapp at dberlin dot org
@ 2006-07-17 16:05 ` patchapp at dberlin dot org
4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2006-07-17 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from patchapp at dberlin dot org 2006-07-17 16:05 -------
Subject: Bug number PR tree-optimization/28144
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00732.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28144
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-07-17 16:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-23 16:44 [Bug tree-optimization/28144] New: floating point constant -> byte/char/short conversion is wrong for java amylaar at gcc dot gnu dot org
2006-06-23 18:00 ` [Bug tree-optimization/28144] " amylaar at gcc dot gnu dot org
2006-06-26 11:19 ` aph at gcc dot gnu dot org
2006-06-26 12:27 ` joern dot rennecke at st dot com
2006-06-29 21:45 ` patchapp at dberlin dot org
2006-07-17 16:05 ` patchapp at dberlin 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).