public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/43128]  New: c-c++-common/pr41779.c doesn't work
@ 2010-02-20  7:12 hjl dot tools at gmail dot com
  2010-02-20 10:40 ` [Bug c/43128] " manu at gcc dot gnu dot org
                   ` (28 more replies)
  0 siblings, 29 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-20  7:12 UTC (permalink / raw)
  To: gcc-bugs

On Linux/ia32, I got

FAIL: c-c++-common/pr41779.c  -Wc++-compat   (test for warnings, line 30)
FAIL: c-c++-common/pr41779.c  -Wc++-compat  (test for excess errors)


-- 
           Summary: c-c++-common/pr41779.c doesn't work
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
@ 2010-02-20 10:40 ` manu at gcc dot gnu dot org
  2010-02-20 11:00   ` Andrew Pinski
  2010-02-20 11:01 ` pinskia at gmail dot com
                   ` (27 subsequent siblings)
  28 siblings, 1 reply; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-20 10:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from manu at gcc dot gnu dot org  2010-02-20 10:40 -------
What are the excess messages?


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-20 10:40:49
               date|                            |


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20 10:40 ` [Bug c/43128] " manu at gcc dot gnu dot org
@ 2010-02-20 11:00   ` Andrew Pinski
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Pinski @ 2010-02-20 11:00 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs



Sent from my iPhone

On Feb 20, 2010, at 2:40 AM, "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #1 from manu at gcc dot gnu dot org  2010-02-20  
> 10:40 -------
> What are the excess messages?
The problem is simple c does nit have overloaded functions. I am  
testing the obvious patch which fixes this; renaming the functions.


>
>
> -- 
>
> manu at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> --- 
> --- 
> ----------------------------------------------------------------------
>             Status|UNCONFIRMED                 |NEW
>     Ever Confirmed|0                           |1
>   Last reconfirmed|0000-00-00 00:00:00         |2010-02-20 10:40:49
>               date|                            |
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43128
>


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
  2010-02-20 10:40 ` [Bug c/43128] " manu at gcc dot gnu dot org
@ 2010-02-20 11:01 ` pinskia at gmail dot com
  2010-02-20 11:51 ` manu at gcc dot gnu dot org
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: pinskia at gmail dot com @ 2010-02-20 11:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gmail dot com  2010-02-20 11:00 -------
Subject: Re:  c-c++-common/pr41779.c doesn't work



Sent from my iPhone

On Feb 20, 2010, at 2:40 AM, "manu at gcc dot gnu dot org"
<gcc-bugzilla@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #1 from manu at gcc dot gnu dot org  2010-02-20  
> 10:40 -------
> What are the excess messages?
The problem is simple c does nit have overloaded functions. I am  
testing the obvious patch which fixes this; renaming the functions.


>
>
> -- 
>
> manu at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> --- 
> --- 
> ----------------------------------------------------------------------
>             Status|UNCONFIRMED                 |NEW
>     Ever Confirmed|0                           |1
>   Last reconfirmed|0000-00-00 00:00:00         |2010-02-20 10:40:49
>               date|                            |
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43128
>


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
  2010-02-20 10:40 ` [Bug c/43128] " manu at gcc dot gnu dot org
  2010-02-20 11:01 ` pinskia at gmail dot com
@ 2010-02-20 11:51 ` manu at gcc dot gnu dot org
  2010-02-20 11:51 ` manu at gcc dot gnu dot org
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-20 11:51 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]



------- Comment #3 from manu at gcc dot gnu dot org  2010-02-20 11:51 -------
Subject: Bug 43128

Author: manu
Date: Sat Feb 20 11:51:02 2010
New Revision: 156924

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156924
Log:
2010-02-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR 43128
        * c-c++-common/pr41779.c: Fix broken testcase.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/pr41779.c


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (2 preceding siblings ...)
  2010-02-20 11:51 ` manu at gcc dot gnu dot org
@ 2010-02-20 11:51 ` manu at gcc dot gnu dot org
  2010-02-20 13:52 ` rguenth at gcc dot gnu dot org
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-20 11:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2010-02-20 11:51 -------
Andrew,

Sorry I read your message after hitting commit!

Is it fixed now?


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (3 preceding siblings ...)
  2010-02-20 11:51 ` manu at gcc dot gnu dot org
@ 2010-02-20 13:52 ` rguenth at gcc dot gnu dot org
  2010-02-20 15:53 ` hjl dot tools at gmail dot com
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-02-20 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-02-20 13:52 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (4 preceding siblings ...)
  2010-02-20 13:52 ` rguenth at gcc dot gnu dot org
@ 2010-02-20 15:53 ` hjl dot tools at gmail dot com
  2010-02-21 15:39 ` hjl dot tools at gmail dot com
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-20 15:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hjl dot tools at gmail dot com  2010-02-20 15:53 -------
On Linux/ia32, I still got

Executing on host: /export/gnu/import/svn/gcc-test/bld/gcc/xgcc
-B/export/gnu/import/svn/gcc-test/bld/gcc/
/export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/c-c++-common/pr41779.c 
 -Wc++-compat  -std=c99 -Wconversion -S  -o pr41779.s    (timeout = 300)
FAIL: c-c++-common/pr41779.c  -Wc++-compat   (test for warnings, line 30)
PASS: c-c++-common/pr41779.c  -Wc++-compat  (test for excess errors)

It may be an ILP32/32bit HW INT issue.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (5 preceding siblings ...)
  2010-02-20 15:53 ` hjl dot tools at gmail dot com
@ 2010-02-21 15:39 ` hjl dot tools at gmail dot com
  2010-02-21 15:56 ` hjl dot tools at gmail dot com
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-21 15:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl dot tools at gmail dot com  2010-02-21 15:39 -------
It also failed on Linux/x86-64 with -m32:

FAIL: c-c++-common/pr41779.c  -Wc++-compat   (test for warnings, line 30)


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2010-02-20 10:40:49         |2010-02-21 15:39:13
               date|                            |


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (6 preceding siblings ...)
  2010-02-21 15:39 ` hjl dot tools at gmail dot com
@ 2010-02-21 15:56 ` hjl dot tools at gmail dot com
  2010-02-21 16:16 ` hjl dot tools at gmail dot com
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-21 15:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (7 preceding siblings ...)
  2010-02-21 15:56 ` hjl dot tools at gmail dot com
@ 2010-02-21 16:16 ` hjl dot tools at gmail dot com
  2010-02-21 16:46 ` [Bug c/43128] [4.5 Regression] " hjl dot tools at gmail dot com
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-21 16:16 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 897 bytes --]



------- Comment #8 from hjl dot tools at gmail dot com  2010-02-21 16:15 -------
It is C99 and ILP32:

[hjl@gnu-6 gcc]$ ./xgcc -B./ -S 
/export/gnu/import/git/gcc/gcc/testsuite/c-c++-common/pr41779.c -Wconversion 
-m32 -std=c99
[hjl@gnu-6 gcc]$ ./xgcc -B./ -S 
/export/gnu/import/git/gcc/gcc/testsuite/c-c++-common/pr41779.c -Wconversion 
-m32 
/export/gnu/import/git/gcc/gcc/testsuite/c-c++-common/pr41779.c: In function
‘f5’:
/export/gnu/import/git/gcc/gcc/testsuite/c-c++-common/pr41779.c:30:3: warning:
conversion to ‘float’ from ‘int’ may alter its value
[hjl@gnu-6 gcc]$ 


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (8 preceding siblings ...)
  2010-02-21 16:16 ` hjl dot tools at gmail dot com
@ 2010-02-21 16:46 ` hjl dot tools at gmail dot com
  2010-02-21 16:48 ` hjl dot tools at gmail dot com
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-21 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hjl dot tools at gmail dot com  2010-02-21 16:46 -------
On Linux/ia32, -std=c99 changes silently float to long double
and we don't get a warning. It is a regression from gcc 4.4.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.5.0
      Known to work|                            |4.4.3
            Summary|c-c++-common/pr41779.c      |[4.5 Regression] c-c++-
                   |doesn't work                |common/pr41779.c doesn't
                   |                            |work


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (9 preceding siblings ...)
  2010-02-21 16:46 ` [Bug c/43128] [4.5 Regression] " hjl dot tools at gmail dot com
@ 2010-02-21 16:48 ` hjl dot tools at gmail dot com
  2010-02-21 17:25 ` manu at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-21 16:48 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 472 bytes --]



------- Comment #10 from hjl dot tools at gmail dot com  2010-02-21 16:47 -------
[hjl@gnu-6 gcc]$ cat /tmp/x.i
float f5(float x, int y)
{
  return x * y;
}
[hjl@gnu-6 gcc]$ gcc -S /tmp/x.i -Wconversion -m32 -std=c99
/tmp/x.i: In function ‘f5’:
/tmp/x.i:3: warning: conversion to ‘float’ from ‘int’ may alter its value
[hjl@gnu-6 gcc]$ ./xgcc -B./ -S /tmp/x.i -Wconversion -m32 -std=c99
[hjl@gnu-6 gcc]$ 


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (10 preceding siblings ...)
  2010-02-21 16:48 ` hjl dot tools at gmail dot com
@ 2010-02-21 17:25 ` manu at gcc dot gnu dot org
  2010-02-21 17:43 ` joseph at codesourcery dot com
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21 17:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from manu at gcc dot gnu dot org  2010-02-21 17:25 -------
I may have miscompared the bootstrap results to miss this because I do test
-m32.

Yes, the excess precision stuff changes the common type to long double in
build_binary_op in C and -m32 (but not in C++!).

Joseph, is this the correct thing to do or a latent bug?


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (11 preceding siblings ...)
  2010-02-21 17:25 ` manu at gcc dot gnu dot org
@ 2010-02-21 17:43 ` joseph at codesourcery dot com
  2010-02-21 17:57 ` manu at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: joseph at codesourcery dot com @ 2010-02-21 17:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from joseph at codesourcery dot com  2010-02-21 17:43 -------
Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
 work

There is a technical bug here, in that the semantics I intended to 
implement and said I was implementing were that implicit conversions from 
integers to floating-point types result in a value representable in the 
new type.  It's not the missing warning that's the bug - right now there 
is a conversion to long double of a value representable in long double, so 
the lack of warning is in accordance with the semantics implemented.  
What is a bug is that the semantics implemented as not as intended.  That 
they are not proper excess precision semantics (and remember that no 
previous release had proper excess precision semantics, so this is barely 
a regression) relies on such implicit conversions not being "operations 
with floating operands" and so not being liable to have excess precision 
under 5.2.4.2.2 paragraph 8.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (12 preceding siblings ...)
  2010-02-21 17:43 ` joseph at codesourcery dot com
@ 2010-02-21 17:57 ` manu at gcc dot gnu dot org
  2010-02-21 18:00 ` hjl dot tools at gmail dot com
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21 17:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from manu at gcc dot gnu dot org  2010-02-21 17:57 -------
(In reply to comment #12)
> Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
>  work

Sorry I do not understand completely your answer. Shouldn't we warn at all? If
the semantics were implemented as intended, should we warn?

Also, the casting to long double seems to be introduced by the float, not by
the integer, if I debugged the code correctly.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (13 preceding siblings ...)
  2010-02-21 17:57 ` manu at gcc dot gnu dot org
@ 2010-02-21 18:00 ` hjl dot tools at gmail dot com
  2010-02-21 18:16 ` joseph at codesourcery dot com
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-21 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from hjl dot tools at gmail dot com  2010-02-21 18:00 -------
That is true that the previous release didn't have proper excess
precision semantics. But from the user perspective, the previous
release handles

--
float f5(float x, int y)
{
  return x * y;
}
--

correctly with "-Wconversion -std=c99". For this particular testcase,
gcc 4.5 has a user visible regression.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (14 preceding siblings ...)
  2010-02-21 18:00 ` hjl dot tools at gmail dot com
@ 2010-02-21 18:16 ` joseph at codesourcery dot com
  2010-02-21 18:25 ` manu at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: joseph at codesourcery dot com @ 2010-02-21 18:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from joseph at codesourcery dot com  2010-02-21 18:15 -------
Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
 work

On Sun, 21 Feb 2010, manu at gcc dot gnu dot org wrote:

> Sorry I do not understand completely your answer. Shouldn't we warn at all? If
> the semantics were implemented as intended, should we warn?

With the intended semantics, we should warn; there would be an actual 
conversion from integer to float there, that could change the value.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (15 preceding siblings ...)
  2010-02-21 18:16 ` joseph at codesourcery dot com
@ 2010-02-21 18:25 ` manu at gcc dot gnu dot org
  2010-02-21 18:32 ` joseph at codesourcery dot com
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21 18:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from manu at gcc dot gnu dot org  2010-02-21 18:25 -------
(In reply to comment #15)
> 
> With the intended semantics, we should warn; there would be an actual 
> conversion from integer to float there, that could change the value.

Great. Any hints where could be the problem or fix?


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (16 preceding siblings ...)
  2010-02-21 18:25 ` manu at gcc dot gnu dot org
@ 2010-02-21 18:32 ` joseph at codesourcery dot com
  2010-02-22 23:56 ` manu at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: joseph at codesourcery dot com @ 2010-02-21 18:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from joseph at codesourcery dot com  2010-02-21 18:32 -------
Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
 work

On Sun, 21 Feb 2010, manu at gcc dot gnu dot org wrote:

> ------- Comment #16 from manu at gcc dot gnu dot org  2010-02-21 18:25 -------
> (In reply to comment #15)
> > 
> > With the intended semantics, we should warn; there would be an actual 
> > conversion from integer to float there, that could change the value.
> 
> Great. Any hints where could be the problem or fix?

Where convert_and_check is called, for (a) conditional expressions and (b) 
binary operations, to convert two operands to a common type, the 
conversion is (correctly) to the type with excess precision (possibly long 
double where the semantic type is narrower, float or double).  I would 
suggest having a c_ep_convert_and_check or similar function that handles 
excess precision: it would take the result type, the semantic result type 
(the type that gets used eventually to build an EXCESS_PRECISION_EXPR) and 
the value to convert.  It would just call convert_and_check, ignoring the 
semantic type, *except* when the operand has integer type *and* the 
semantic type is non-NULL; in that case, it would first convert to the 
semantic type them to the result type.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (17 preceding siblings ...)
  2010-02-21 18:32 ` joseph at codesourcery dot com
@ 2010-02-22 23:56 ` manu at gcc dot gnu dot org
  2010-02-23  0:27 ` manu at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-22 23:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from manu at gcc dot gnu dot org  2010-02-22 23:56 -------
(In reply to comment #17)
> suggest having a c_ep_convert_and_check or similar function that handles 
> excess precision: it would take the result type, the semantic result type 
> (the type that gets used eventually to build an EXCESS_PRECISION_EXPR) and 
> the value to convert.  It would just call convert_and_check, ignoring the 
> semantic type, *except* when the operand has integer type *and* the 
> semantic type is non-NULL; in that case, it would first convert to the 
> semantic type them to the result type.

Wouldn't that change the normal result of promotion rules?

Also, why call convert_and_check ignoring the semantic type and not just call
convert? The excess precision type should be large enough to not cause any
problem that needs checking.


> 


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (18 preceding siblings ...)
  2010-02-22 23:56 ` manu at gcc dot gnu dot org
@ 2010-02-23  0:27 ` manu at gcc dot gnu dot org
  2010-02-23  0:30 ` joseph at codesourcery dot com
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-23  0:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|REOPENED                    |ASSIGNED
   Last reconfirmed|2010-02-21 15:39:13         |2010-02-23 00:27:14
               date|                            |


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (19 preceding siblings ...)
  2010-02-23  0:27 ` manu at gcc dot gnu dot org
@ 2010-02-23  0:30 ` joseph at codesourcery dot com
  2010-02-23  8:39 ` manu at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: joseph at codesourcery dot com @ 2010-02-23  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from joseph at codesourcery dot com  2010-02-23 00:29 -------
Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
 work

On Mon, 22 Feb 2010, manu at gcc dot gnu dot org wrote:

> ------- Comment #18 from manu at gcc dot gnu dot org  2010-02-22 23:56 -------
> (In reply to comment #17)
> > suggest having a c_ep_convert_and_check or similar function that handles 
> > excess precision: it would take the result type, the semantic result type 
> > (the type that gets used eventually to build an EXCESS_PRECISION_EXPR) and 
> > the value to convert.  It would just call convert_and_check, ignoring the 
> > semantic type, *except* when the operand has integer type *and* the 
> > semantic type is non-NULL; in that case, it would first convert to the 
> > semantic type them to the result type.
> 
> Wouldn't that change the normal result of promotion rules?

No.

The present logic is: convert (with convert_and_check) both operands to a 
common type, which may have excess precision; then, later, after producing 
the tree for the result of the operation, wrap that in an 
EXCESS_PRECISION_EXPR, using the semantic type, if there is a semantic 
type different from the type with excess precision.

The proposed logic is the same, *except* that the conversion to a common 
type goes via the semantic type, *if* there is excess precision involved 
*and* the operand being converted had integer type.

> Also, why call convert_and_check ignoring the semantic type and not just call
> convert? The excess precision type should be large enough to not cause any
> problem that needs checking.

Yes, you could just use convert for the second conversion (semantic type 
to type with excess precision).


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (20 preceding siblings ...)
  2010-02-23  0:30 ` joseph at codesourcery dot com
@ 2010-02-23  8:39 ` manu at gcc dot gnu dot org
  2010-02-23 10:23 ` manu at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-23  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from manu at gcc dot gnu dot org  2010-02-23 08:39 -------
(In reply to comment #19)
> 
> The proposed logic is the same, *except* that the conversion to a common 
> type goes via the semantic type, *if* there is excess precision involved 
> *and* the operand being converted had integer type.

In order to know the common_type I need to move the test for build_type before
the calls to convert_and_check. What is build_type for?


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (21 preceding siblings ...)
  2010-02-23  8:39 ` manu at gcc dot gnu dot org
@ 2010-02-23 10:23 ` manu at gcc dot gnu dot org
  2010-02-23 16:32 ` joseph at codesourcery dot com
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-23 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from manu at gcc dot gnu dot org  2010-02-23 10:23 -------
(In reply to comment #19)
> 
> The present logic is: convert (with convert_and_check) both operands to a 
> common type, which may have excess precision; then, later, after producing 
> the tree for the result of the operation, wrap that in an 
> EXCESS_PRECISION_EXPR, using the semantic type, if there is a semantic 
> type different from the type with excess precision.

This is only true for build_binary_op. In build_conditional_expr both operands
are converted to the semantic type first, if I am reading the code correctly,
so there is nothing to fix (in fact, I cannot build a testcase that misses the
warning when using conditional expression).

The code of build_binary_op is a bit complex, specially the interaction between
result_type, final_type, buid_type, converted and real_result_type.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (22 preceding siblings ...)
  2010-02-23 10:23 ` manu at gcc dot gnu dot org
@ 2010-02-23 16:32 ` joseph at codesourcery dot com
  2010-02-23 16:39 ` joseph at codesourcery dot com
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: joseph at codesourcery dot com @ 2010-02-23 16:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from joseph at codesourcery dot com  2010-02-23 16:32 -------
Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
 work

On Tue, 23 Feb 2010, manu at gcc dot gnu dot org wrote:

> ------- Comment #20 from manu at gcc dot gnu dot org  2010-02-23 08:39 -------
> (In reply to comment #19)
> > 
> > The proposed logic is the same, *except* that the conversion to a common 
> > type goes via the semantic type, *if* there is excess precision involved 
> > *and* the operand being converted had integer type.
> 
> In order to know the common_type I need to move the test for build_type before
> the calls to convert_and_check. What is build_type for?

build_type is for comparisons, when the (semantic) type of the result of 
the expression is not the same as the (semantic) common type of the 
operands.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (23 preceding siblings ...)
  2010-02-23 16:32 ` joseph at codesourcery dot com
@ 2010-02-23 16:39 ` joseph at codesourcery dot com
  2010-02-23 17:34 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: joseph at codesourcery dot com @ 2010-02-23 16:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from joseph at codesourcery dot com  2010-02-23 16:38 -------
Subject: Re:  [4.5 Regression] c-c++-common/pr41779.c doesn't
 work

On Tue, 23 Feb 2010, manu at gcc dot gnu dot org wrote:

> ------- Comment #21 from manu at gcc dot gnu dot org  2010-02-23 10:23 -------
> (In reply to comment #19)
> > 
> > The present logic is: convert (with convert_and_check) both operands to a 
> > common type, which may have excess precision; then, later, after producing 
> > the tree for the result of the operation, wrap that in an 
> > EXCESS_PRECISION_EXPR, using the semantic type, if there is a semantic 
> > type different from the type with excess precision.
> 
> This is only true for build_binary_op. In build_conditional_expr both operands
> are converted to the semantic type first, if I am reading the code correctly,
> so there is nothing to fix (in fact, I cannot build a testcase that misses the
> warning when using conditional expression).

No, the conversion is to the type with excess precision.  Try:

float a;  
int b;
int c;           
long double f(void) { return c ? a + a : b; }

If you use "a" instead of "a + a", then it's just a float rather than a 
long double wrapped in an EXCESS_PRECISION_EXPR.  build_binary_op 
explicitly adds excess precision early on for various operations where it 
is necessary to describe the semantics of what the processor can do.  But 
there is no need to add excess precision for a conditional expression - 
just to handle operands that already have it.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (24 preceding siblings ...)
  2010-02-23 16:39 ` joseph at codesourcery dot com
@ 2010-02-23 17:34 ` manu at gcc dot gnu dot org
  2010-02-24 10:39 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-23 17:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from manu at gcc dot gnu dot org  2010-02-23 17:33 -------
OK, I get it. Thanks for the explanation. Testing a patch.


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (25 preceding siblings ...)
  2010-02-23 17:34 ` manu at gcc dot gnu dot org
@ 2010-02-24 10:39 ` manu at gcc dot gnu dot org
  2010-02-24 13:10 ` manu at gcc dot gnu dot org
  2010-02-24 13:10 ` manu at gcc dot gnu dot org
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 10:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from manu at gcc dot gnu dot org  2010-02-24 10:39 -------
PATCH: http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00969.html


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (27 preceding siblings ...)
  2010-02-24 13:10 ` manu at gcc dot gnu dot org
@ 2010-02-24 13:10 ` manu at gcc dot gnu dot org
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 13:10 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]



------- Comment #26 from manu at gcc dot gnu dot org  2010-02-24 13:09 -------
Subject: Bug 43128

Author: manu
Date: Wed Feb 24 13:09:37 2010
New Revision: 157040

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157040
Log:
2010-02-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR c/43128
        * c-typeck.c (ep_convert_and_check): New.
        (build_conditional_expr): Use it.
        (build_binary_op): Likewise.
testsuite/      
        * c-c++-common/pr41779.c: Update.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/pr41779.c


-- 


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
  2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
                   ` (26 preceding siblings ...)
  2010-02-24 10:39 ` manu at gcc dot gnu dot org
@ 2010-02-24 13:10 ` manu at gcc dot gnu dot org
  2010-02-24 13:10 ` manu at gcc dot gnu dot org
  28 siblings, 0 replies; 31+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 13:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from manu at gcc dot gnu dot org  2010-02-24 13:10 -------
It should be FIXED for GCC 4.5


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2010-02-24 13:10 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-20  7:12 [Bug c/43128] New: c-c++-common/pr41779.c doesn't work hjl dot tools at gmail dot com
2010-02-20 10:40 ` [Bug c/43128] " manu at gcc dot gnu dot org
2010-02-20 11:00   ` Andrew Pinski
2010-02-20 11:01 ` pinskia at gmail dot com
2010-02-20 11:51 ` manu at gcc dot gnu dot org
2010-02-20 11:51 ` manu at gcc dot gnu dot org
2010-02-20 13:52 ` rguenth at gcc dot gnu dot org
2010-02-20 15:53 ` hjl dot tools at gmail dot com
2010-02-21 15:39 ` hjl dot tools at gmail dot com
2010-02-21 15:56 ` hjl dot tools at gmail dot com
2010-02-21 16:16 ` hjl dot tools at gmail dot com
2010-02-21 16:46 ` [Bug c/43128] [4.5 Regression] " hjl dot tools at gmail dot com
2010-02-21 16:48 ` hjl dot tools at gmail dot com
2010-02-21 17:25 ` manu at gcc dot gnu dot org
2010-02-21 17:43 ` joseph at codesourcery dot com
2010-02-21 17:57 ` manu at gcc dot gnu dot org
2010-02-21 18:00 ` hjl dot tools at gmail dot com
2010-02-21 18:16 ` joseph at codesourcery dot com
2010-02-21 18:25 ` manu at gcc dot gnu dot org
2010-02-21 18:32 ` joseph at codesourcery dot com
2010-02-22 23:56 ` manu at gcc dot gnu dot org
2010-02-23  0:27 ` manu at gcc dot gnu dot org
2010-02-23  0:30 ` joseph at codesourcery dot com
2010-02-23  8:39 ` manu at gcc dot gnu dot org
2010-02-23 10:23 ` manu at gcc dot gnu dot org
2010-02-23 16:32 ` joseph at codesourcery dot com
2010-02-23 16:39 ` joseph at codesourcery dot com
2010-02-23 17:34 ` manu at gcc dot gnu dot org
2010-02-24 10:39 ` manu at gcc dot gnu dot org
2010-02-24 13:10 ` manu at gcc dot gnu dot org
2010-02-24 13:10 ` manu 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).