public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41435]  New: GCC doesn't fold complex int division
@ 2009-09-22 15:28 ghazi at gcc dot gnu dot org
  2009-09-23 18:24 ` [Bug middle-end/41435] " ghazi at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ghazi at gcc dot gnu dot org @ 2009-09-22 15:28 UTC (permalink / raw)
  To: gcc-bugs

For integral complex types like complex int, GCC doesn't fold division with
constant arguments.  E.g. this testcase should evaluate at compile-time and
link without any errors but doesn't:

extern void link_error(void);
#define EXPR ((2 + 4i) / 2)
int main(void)
{
  if (__real EXPR != 1 || __imag EXPR != 2)
    link_error();

  return 0;
}


-- 
           Summary: GCC doesn't fold complex int division
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ghazi at gcc dot gnu dot org


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


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

* [Bug middle-end/41435] GCC doesn't fold complex int division
  2009-09-22 15:28 [Bug middle-end/41435] New: GCC doesn't fold complex int division ghazi at gcc dot gnu dot org
@ 2009-09-23 18:24 ` ghazi at gcc dot gnu dot org
  2009-09-24  7:08 ` ghazi at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ghazi at gcc dot gnu dot org @ 2009-09-23 18:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ghazi at gcc dot gnu dot org  2009-09-23 18:24 -------
Mine, working on a patch


-- 

ghazi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ghazi at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-09-23 18:24:18
               date|                            |


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


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

* [Bug middle-end/41435] GCC doesn't fold complex int division
  2009-09-22 15:28 [Bug middle-end/41435] New: GCC doesn't fold complex int division ghazi at gcc dot gnu dot org
  2009-09-23 18:24 ` [Bug middle-end/41435] " ghazi at gcc dot gnu dot org
@ 2009-09-24  7:08 ` ghazi at gcc dot gnu dot org
  2009-09-24 20:45 ` ghazi at gcc dot gnu dot org
  2009-09-27 14:00 ` ghazi at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ghazi at gcc dot gnu dot org @ 2009-09-24  7:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ghazi at gcc dot gnu dot org  2009-09-24 07:08 -------
Patch posted here:
http://gcc.gnu.org/ml/gcc-patches/2009-09/msg01685.html


-- 


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


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

* [Bug middle-end/41435] GCC doesn't fold complex int division
  2009-09-22 15:28 [Bug middle-end/41435] New: GCC doesn't fold complex int division ghazi at gcc dot gnu dot org
  2009-09-23 18:24 ` [Bug middle-end/41435] " ghazi at gcc dot gnu dot org
  2009-09-24  7:08 ` ghazi at gcc dot gnu dot org
@ 2009-09-24 20:45 ` ghazi at gcc dot gnu dot org
  2009-09-27 14:00 ` ghazi at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ghazi at gcc dot gnu dot org @ 2009-09-24 20:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ghazi at gcc dot gnu dot org  2009-09-24 20:45 -------
Subject: Bug 41435

Author: ghazi
Date: Thu Sep 24 20:44:55 2009
New Revision: 152145

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152145
Log:
        PR middle-end/41435
        * fold-const.c (const_binop): Handle complex int division.
        * tree-complex.c (expand_complex_div_straight,
        expand_complex_div_wide): Update comments.

testsuite:
        * gcc.dg/torture/builtin-math-7.c: Test complex int division at
        compile-time.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/torture/builtin-math-7.c
    trunk/gcc/tree-complex.c


-- 


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


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

* [Bug middle-end/41435] GCC doesn't fold complex int division
  2009-09-22 15:28 [Bug middle-end/41435] New: GCC doesn't fold complex int division ghazi at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-09-24 20:45 ` ghazi at gcc dot gnu dot org
@ 2009-09-27 14:00 ` ghazi at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ghazi at gcc dot gnu dot org @ 2009-09-27 14:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ghazi at gcc dot gnu dot org  2009-09-27 13:59 -------
Fixed


-- 

ghazi at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-09-27 14:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22 15:28 [Bug middle-end/41435] New: GCC doesn't fold complex int division ghazi at gcc dot gnu dot org
2009-09-23 18:24 ` [Bug middle-end/41435] " ghazi at gcc dot gnu dot org
2009-09-24  7:08 ` ghazi at gcc dot gnu dot org
2009-09-24 20:45 ` ghazi at gcc dot gnu dot org
2009-09-27 14:00 ` ghazi 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).