public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40290] New: Questionable warning for REAL*COMPLEX with -Wconversion
@ 2009-05-29 11:20 anlauf at gmx dot de
2009-12-10 21:46 ` [Bug fortran/40290] " dfranke at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: anlauf at gmx dot de @ 2009-05-29 11:20 UTC (permalink / raw)
To: gcc-bugs
Hi,
the following warning appears questionable:
subroutine gfcbug87
implicit none
real :: x
complex :: c
c = c * x
end subroutine gfcbug87
gfcbug87.f90:5.11:
c = c * x
1
Warning: Conversion from REAL(4) to COMPLEX(4) at (1)
There are really no kind conversions involved. In fact, I do even hope
that the optimizer knowns that REAL*COMPLEX is a much cheaper operation
than the full COMPLEX*COMPLEX implied by the warning.
--
Summary: Questionable warning for REAL*COMPLEX with -Wconversion
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anlauf at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40290
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40290] Questionable warning for REAL*COMPLEX with -Wconversion
2009-05-29 11:20 [Bug fortran/40290] New: Questionable warning for REAL*COMPLEX with -Wconversion anlauf at gmx dot de
@ 2009-12-10 21:46 ` dfranke at gcc dot gnu dot org
2009-12-11 18:57 ` [Bug fortran/40290] Spurious warning on " dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-10 21:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dfranke at gcc dot gnu dot org 2009-12-10 21:46 -------
Actually, the program
real :: x
complex :: c
c = c * x
end
is directly translated to ...
MAIN__ ()
{
complex(kind=4) c;
real(kind=4) x;
c = COMPLEX_EXPR <x, 0.0> * c;
}
... and yukka, the "optimized" dump has ...
real(kind=4) D.1522;
real(kind=4) D.1521;
real(kind=4) D.1520;
real(kind=4) D.1519;
real(kind=4) D.1518;
real(kind=4) D.1517;
real(kind=4) D.1516;
real(kind=4) D.1515;
real(kind=4) D.1514;
real(kind=4) D.1513;
real(kind=4) x;
complex(kind=4) c;
complex(kind=4) c.2;
complex(kind=4) c.1;
complex(kind=4) D.1510;
<bb 2>:
D.1510_2 = COMPLEX_EXPR <x_1(D), 0.0>;
c.1_3 = c;
D.1513_4 = REALPART_EXPR <D.1510_2>;
D.1514_5 = IMAGPART_EXPR <D.1510_2>;
D.1515_6 = REALPART_EXPR <c.1_3>;
D.1516_7 = IMAGPART_EXPR <c.1_3>;
D.1517_8 = D.1513_4 * D.1515_6;
D.1518_9 = D.1514_5 * D.1516_7;
D.1519_10 = D.1513_4 * D.1516_7;
D.1520_11 = D.1514_5 * D.1515_6;
D.1521_12 = D.1517_8 - D.1518_9;
D.1522_13 = D.1519_10 + D.1520_11;
c.2_14 = COMPLEX_EXPR <D.1521_12, D.1522_13>;
c = c.2_14;
return;
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-12-10 21:46:21
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40290
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40290] Spurious warning on REAL*COMPLEX with -Wconversion
2009-05-29 11:20 [Bug fortran/40290] New: Questionable warning for REAL*COMPLEX with -Wconversion anlauf at gmx dot de
2009-12-10 21:46 ` [Bug fortran/40290] " dfranke at gcc dot gnu dot org
@ 2009-12-11 18:57 ` dfranke at gcc dot gnu dot org
2009-12-11 21:09 ` dfranke at gcc dot gnu dot org
2009-12-11 21:10 ` dfranke at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-11 18:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dfranke at gcc dot gnu dot org 2009-12-11 18:56 -------
Using "-O3 -fno-signed-zeros" (the latter being set by -ffast-math) gets rid of
all the additional computations and results in
<bb 2>:
D.1504_2 = *a_1(D);
D.1514_10 = REALPART_EXPR <*b_4(D)>;
D.1515_11 = IMAGPART_EXPR <*b_4(D)>;
D.1516_12 = D.1504_2 * D.1514_10;
D.1517_13 = D.1504_2 * D.1515_11;
__result_op.0_6 = COMPLEX_EXPR <D.1516_12, D.1517_13>;
return __result_op.0_6;
With the patch below, the warning would be disabled. However is this warning a
feature (then keep it), or an artefact of an implementation detail (then remove
it)?
Index: expr.c
===================================================================
--- expr.c (revision 155148)
+++ expr.c (working copy)
@@ -720,9 +720,9 @@ gfc_type_convert_binary (gfc_expr *e)
else
e->ts.kind = op2->ts.kind;
if (op1->ts.type != BT_COMPLEX || op1->ts.kind != e->ts.kind)
- gfc_convert_type (e->value.op.op1, &e->ts, 2);
+ gfc_convert_type_warn (e->value.op.op1, &e->ts, 2, 0);
if (op2->ts.type != BT_COMPLEX || op2->ts.kind != e->ts.kind)
- gfc_convert_type (e->value.op.op2, &e->ts, 2);
+ gfc_convert_type_warn (e->value.op.op2, &e->ts, 2, 0);
done:
return;
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|missed-optimization |
Known to fail|4.5.0 |
Summary|Bogus conversion of |Spurious warning on
|REAL*COMPLEX to |REAL*COMPLEX with -
|COMPLEX*COMPLEX |Wconversion
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40290
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40290] Spurious warning on REAL*COMPLEX with -Wconversion
2009-05-29 11:20 [Bug fortran/40290] New: Questionable warning for REAL*COMPLEX with -Wconversion anlauf at gmx dot de
2009-12-10 21:46 ` [Bug fortran/40290] " dfranke at gcc dot gnu dot org
2009-12-11 18:57 ` [Bug fortran/40290] Spurious warning on " dfranke at gcc dot gnu dot org
@ 2009-12-11 21:09 ` dfranke at gcc dot gnu dot org
2009-12-11 21:10 ` dfranke at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-11 21:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dfranke at gcc dot gnu dot org 2009-12-11 21:08 -------
Subject: Bug 40290
Author: dfranke
Date: Fri Dec 11 21:08:39 2009
New Revision: 155179
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155179
Log:
2009-12-11 Daniel Franke <franke.daniel@gmail.com>
PR fortran/40290
* expr.c (gfc_type_convert_binary): Added warn-on-conversion flag,
passed on to gfc_convert_type_warn() instead of gfc_convert_type();
enabled warnings on all callers but ...
* arith.c (eval_intrinsic): Disabled warnings on implicit type
conversion.
* gfortran.h gfc_type_convert_binary): Adjusted prototype.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/arith.c
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/iresolve.c
trunk/gcc/fortran/resolve.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40290
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40290] Spurious warning on REAL*COMPLEX with -Wconversion
2009-05-29 11:20 [Bug fortran/40290] New: Questionable warning for REAL*COMPLEX with -Wconversion anlauf at gmx dot de
` (2 preceding siblings ...)
2009-12-11 21:09 ` dfranke at gcc dot gnu dot org
@ 2009-12-11 21:10 ` dfranke at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-11 21:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dfranke at gcc dot gnu dot org 2009-12-11 21:10 -------
Fixed in trunk. Closing.
Thanks for the report!
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40290
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-12-11 21:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-29 11:20 [Bug fortran/40290] New: Questionable warning for REAL*COMPLEX with -Wconversion anlauf at gmx dot de
2009-12-10 21:46 ` [Bug fortran/40290] " dfranke at gcc dot gnu dot org
2009-12-11 18:57 ` [Bug fortran/40290] Spurious warning on " dfranke at gcc dot gnu dot org
2009-12-11 21:09 ` dfranke at gcc dot gnu dot org
2009-12-11 21:10 ` dfranke 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).