public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50992] New: abs() and cabs()
@ 2011-11-04 14:38 bratsinot at gmail dot com
  2011-11-04 14:45 ` [Bug c/50992] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bratsinot at gmail dot com @ 2011-11-04 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50992
           Summary: abs() and cabs()
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bratsinot@gmail.com


gcc does not see an obvious error.
Code:
  complex double Z;
  abs(Z);
abs() even not a fabsl()! And this code work!


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

* [Bug c/50992] abs() and cabs()
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
@ 2011-11-04 14:45 ` paolo.carlini at oracle dot com
  2011-11-04 15:01 ` bratsinot at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-04 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-11-04
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-04 14:45:39 UTC ---
Please provide a *self-contained*, minimal testcase. Thanks,


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

* [Bug c/50992] abs() and cabs()
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
  2011-11-04 14:45 ` [Bug c/50992] " paolo.carlini at oracle dot com
@ 2011-11-04 15:01 ` bratsinot at gmail dot com
  2011-11-04 15:08 ` manu at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bratsinot at gmail dot com @ 2011-11-04 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alexander <bratsinot at gmail dot com> 2011-11-04 14:59:53 UTC ---
Created attachment 25714
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25714
NULL

I right now noticed that abs() just return real part of complex number.


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

* [Bug c/50992] abs() and cabs()
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
  2011-11-04 14:45 ` [Bug c/50992] " paolo.carlini at oracle dot com
  2011-11-04 15:01 ` bratsinot at gmail dot com
@ 2011-11-04 15:08 ` manu at gcc dot gnu.org
  2011-11-04 15:12 ` bratsinot at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2011-11-04 15:08 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |manu at gcc dot gnu.org

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-11-04 15:08:09 UTC ---
#include <complex.h>

extern int abs(int);
int foo(void) {
  complex double Z = 0.1 + 0.2I;
  return abs(Z);
}

GCC says nothing with -Wall -Wextra -Wconversion, because
c-common.c:conversion_warnings() does not handle complex variables.

Clang:

test.c:6:14: warning: implicit conversion discards imaginary component:
'_Complex double' to 'int' [-Wconversion]
  return abs(Z);
         ~~~ ^
1 warning generated.


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

* [Bug c/50992] abs() and cabs()
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
                   ` (2 preceding siblings ...)
  2011-11-04 15:08 ` manu at gcc dot gnu.org
@ 2011-11-04 15:12 ` bratsinot at gmail dot com
  2011-11-04 15:18 ` [Bug c/50992] Wconversion does not handle complex type conversions manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bratsinot at gmail dot com @ 2011-11-04 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander <bratsinot at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Wconversion does not handle |abs() and cabs()
                   |complex type conversions    |

--- Comment #4 from Alexander <bratsinot at gmail dot com> 2011-11-04 15:12:13 UTC ---
(In reply to comment #3)
> #include <complex.h>
> 
> extern int abs(int);
> int foo(void) {
>   complex double Z = 0.1 + 0.2I;
>   return abs(Z);
> }
> 
> GCC says nothing with -Wall -Wextra -Wconversion, because
> c-common.c:conversion_warnings() does not handle complex variables.
> 
> Clang:
> 
> test.c:6:14: warning: implicit conversion discards imaginary component:
> '_Complex double' to 'int' [-Wconversion]
>   return abs(Z);
>          ~~~ ^
> 1 warning generated.

I noticed. So what? Why was this done?


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

* [Bug c/50992] Wconversion does not handle complex type conversions
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
                   ` (3 preceding siblings ...)
  2011-11-04 15:12 ` bratsinot at gmail dot com
@ 2011-11-04 15:18 ` manu at gcc dot gnu.org
  2011-11-04 15:23 ` bratsinot at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2011-11-04 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-11-04 15:18:23 UTC ---
(In reply to comment #4)
> 
> I noticed. So what? Why was this done?

It is just not implemented yet. Someone needs to want it enough to implement
it.


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

* [Bug c/50992] Wconversion does not handle complex type conversions
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
                   ` (4 preceding siblings ...)
  2011-11-04 15:18 ` [Bug c/50992] Wconversion does not handle complex type conversions manu at gcc dot gnu.org
@ 2011-11-04 15:23 ` bratsinot at gmail dot com
  2011-11-04 15:28 ` manu at gcc dot gnu.org
  2012-03-24 19:28 ` manu at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: bratsinot at gmail dot com @ 2011-11-04 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander <bratsinot at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--- Comment #6 from Alexander <bratsinot at gmail dot com> 2011-11-04 15:22:53 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > 
> > I noticed. So what? Why was this done?
> 
> It is just not implemented yet. Someone needs to want it enough to implement
> it.

May be people just not see that thing, like me(I noticed this only after a
couple of hours).


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

* [Bug c/50992] Wconversion does not handle complex type conversions
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
                   ` (5 preceding siblings ...)
  2011-11-04 15:23 ` bratsinot at gmail dot com
@ 2011-11-04 15:28 ` manu at gcc dot gnu.org
  2012-03-24 19:28 ` manu at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2011-11-04 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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

* [Bug c/50992] Wconversion does not handle complex type conversions
  2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
                   ` (6 preceding siblings ...)
  2011-11-04 15:28 ` manu at gcc dot gnu.org
@ 2012-03-24 19:28 ` manu at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2012-03-24 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

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

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-03-24 19:14:49 UTC ---
It seems someone did a patch in a different bug report, but didn't submit it
for approval.

*** This bug has been marked as a duplicate of bug 48956 ***


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

end of thread, other threads:[~2012-03-24 19:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-04 14:38 [Bug c/50992] New: abs() and cabs() bratsinot at gmail dot com
2011-11-04 14:45 ` [Bug c/50992] " paolo.carlini at oracle dot com
2011-11-04 15:01 ` bratsinot at gmail dot com
2011-11-04 15:08 ` manu at gcc dot gnu.org
2011-11-04 15:12 ` bratsinot at gmail dot com
2011-11-04 15:18 ` [Bug c/50992] Wconversion does not handle complex type conversions manu at gcc dot gnu.org
2011-11-04 15:23 ` bratsinot at gmail dot com
2011-11-04 15:28 ` manu at gcc dot gnu.org
2012-03-24 19:28 ` manu at gcc dot gnu.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).