public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13718] New: Miscompilation of comparison of complex values
@ 2004-01-17 14:09 pbrook at gcc dot gnu dot org
  2004-01-17 14:33 ` [Bug optimization/13718] " steven at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2004-01-17 14:09 UTC (permalink / raw)
  To: gcc-bugs

Something seems to be going wrong with the handling of complex variables. From 
looking at the tree dumps it seems SRA might be the culprit. 
 
Testcase follows. 
 
void 
foo( _Complex float * a, _Complex float * b) 
{ 
  if (*a != *b) 
        abort (); 
} 
 
int main() 
{ 
  _Complex float v; 
  v = 0; 
  foo (&v, &v); 
}

-- 
           Summary: Miscompilation of comparison of complex values
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pbrook at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug optimization/13718] Miscompilation of comparison of complex values
  2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
@ 2004-01-17 14:33 ` steven at gcc dot gnu dot org
  2004-01-17 15:00 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-17 14:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-01-17 14:33 -------
Yup. 
 
Dump "t.c.t22.complex": 
;; Function foo (foo) 
foo (a, b) 
{ 
  complex float T.2; 
  complex float T.1; 
<bb 0>: 
  T.1 = *a_1; 
  T.2 = *b_4; 
  if (T.1 != T.2) goto <L0>; else goto <L1>; 
<L0>:; 
  abort (); 
<L1>:; 
  return; 
} 
 
Dump "t.c.t23.sra": 
Scalar replacements for foo: 
__real__ T.1 -> SR.4 
__imag__ T.1 -> SR.5 
__real__ T.2 -> SR.6 
__imag__ T.2 -> SR.7 
 
;; Function foo (foo) 
foo (a, b) 
{ 
  float SR.7; 
  float SR.6; 
  float SR.5; 
  float SR.4; 
  complex float T.2; 
  complex float T.1; 
<bb 0>: 
  SR.4_6 = REALPART_EXPR <*a_1>; 
  SR.5_3 = IMAGPART_EXPR <*a_1>; 
  SR.6_8 = REALPART_EXPR <*b_4>; 
  SR.7_9 = IMAGPART_EXPR <*b_4>; 
  if (T.1 != T.2) goto <L0>; else goto <L1>; 
<L0>:; 
  abort (); 
<L1>:; 
  return; 
} 
 
Dump "t.c.t25.dce3": 
;; Function foo (foo) 
foo (a, b) 
{ 
  float SR.7; 
  float SR.6; 
  float SR.5; 
  float SR.4; 
  complex float T.2; 
  complex float T.1; 
<bb 0>: 
  if (T.1 != T.2) goto <L0>; else goto <L1>; 
<L0>:; 
  abort (); 
<L1>:; 
  return; 
} 
 
Now where did the assignments go? 
 
BTW why isn't T.1 != T.2 folded to compare the real and imag parts? 
 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-17 14:33:20
               date|                            |


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


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

* [Bug optimization/13718] Miscompilation of comparison of complex values
  2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
  2004-01-17 14:33 ` [Bug optimization/13718] " steven at gcc dot gnu dot org
@ 2004-01-17 15:00 ` steven at gcc dot gnu dot org
  2004-01-17 20:30 ` [Bug optimization/13718] [tree-ssa] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-17 15:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-01-17 15:00 -------
Here is another nice one: 
--------------------------- 
extern void foo( _Complex float a, _Complex float b); 
 
int main() 
{ 
  _Complex float v; 
  v = 0; 
  foo (v, v); 
} 
--------------------------- 
 
----> t.c.t23.sra: 
Scalar replacements for main: 
 
__real__ v -> SR.1 
__imag__ v -> SR.2 
 
;; Function main (main) 
main () 
{ 
  float SR.2; 
  float SR.1; 
  complex float v; 
<bb 0>: 
  SR.1_2 = 0.0; 
  SR.2_3 = 0.0; 
  v = COMPLEX_EXPR <SR.1_2, SR.2_3>; 
  v = COMPLEX_EXPR <SR.1_2, SR.2_3>; 
  foo (v, v); 
  return; 
} 
 
 
----> t.c.t33.optimized 
;; Function main (main) 
main () 
{ 
  complex float v; 
<bb 0>: 
  v = __complex__ (0.0, 0.0); 
  v = __complex__ (0.0, 0.0); 
  foo (v, v); 
  return; 
} 
 
 
SRA for complex seems to just not work yet.  RTH, you worked on 
this, so I have assigned this bug to you. 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at redhat dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug optimization/13718] [tree-ssa] Miscompilation of comparison of complex values
  2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
  2004-01-17 14:33 ` [Bug optimization/13718] " steven at gcc dot gnu dot org
  2004-01-17 15:00 ` steven at gcc dot gnu dot org
@ 2004-01-17 20:30 ` pinskia at gcc dot gnu dot org
  2004-01-17 20:51 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-17 20:30 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Miscompilation of comparison|[tree-ssa] Miscompilation of
                   |of complex values           |comparison of complex values
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/13718] [tree-ssa] Miscompilation of comparison of complex values
  2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-01-17 20:30 ` [Bug optimization/13718] [tree-ssa] " pinskia at gcc dot gnu dot org
@ 2004-01-17 20:51 ` cvs-commit at gcc dot gnu dot org
  2004-01-17 20:55 ` rth at gcc dot gnu dot org
  2004-01-17 21:00 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-17 20:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-17 20:51 -------
Subject: Bug 13718

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	rth@gcc.gnu.org	2004-01-17 20:51:22

Modified files:
	gcc            : ChangeLog.tree-ssa tree-complex.c 

Log message:
	PR opt/13718
	* tree-complex.c (expand_complex_comparison): Handle COND_EXPR.
	(expand_complex_operations_1): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.1094&r2=1.1.2.1095
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-complex.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3



-- 


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


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

* [Bug optimization/13718] [tree-ssa] Miscompilation of comparison of complex values
  2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-01-17 20:51 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-17 20:55 ` rth at gcc dot gnu dot org
  2004-01-17 21:00 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-01-17 20:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-01-17 20:55 -------
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01724.html
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01729.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|tree-ssa                    |---


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


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

* [Bug optimization/13718] [tree-ssa] Miscompilation of comparison of complex values
  2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-01-17 20:55 ` rth at gcc dot gnu dot org
@ 2004-01-17 21:00 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-17 21:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |tree-ssa


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


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

end of thread, other threads:[~2004-01-17 21:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-17 14:09 [Bug optimization/13718] New: Miscompilation of comparison of complex values pbrook at gcc dot gnu dot org
2004-01-17 14:33 ` [Bug optimization/13718] " steven at gcc dot gnu dot org
2004-01-17 15:00 ` steven at gcc dot gnu dot org
2004-01-17 20:30 ` [Bug optimization/13718] [tree-ssa] " pinskia at gcc dot gnu dot org
2004-01-17 20:51 ` cvs-commit at gcc dot gnu dot org
2004-01-17 20:55 ` rth at gcc dot gnu dot org
2004-01-17 21:00 ` pinskia 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).