public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops
@ 2012-04-21 12:09 marc.glisse at normalesup dot org
  2012-04-21 13:44 ` [Bug c/53060] " manu at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: marc.glisse at normalesup dot org @ 2012-04-21 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53060
           Summary: Typo in build_binary_op for scalar-vector ops
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marc.glisse@normalesup.org


Hello,

in file c-typeck.c, function build_binary_op, for mixed scalar-vector
operations, there are 2 cases: stv_firstarg and stv_secondarg. The first one
has:
                op0 = c_wrap_maybe_const (op0, true);
while the second has:
                op0 = c_wrap_maybe_const (op1, true);

I think the second one should read "op1 = ...", for symmetry.

I haven't managed to come up with a testcase that runs this line of code :-(


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

* [Bug c/53060] Typo in build_binary_op for scalar-vector ops
  2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
@ 2012-04-21 13:44 ` manu at gcc dot gnu.org
  2012-04-21 15:01 ` marc.glisse at normalesup dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-21 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-21 13:42:32 UTC ---
Have you tried setting a breakpoint there when running:


        * gcc.c-torture/execute/scal-to-vec1.c: New test.
        * gcc.c-torture/execute/scal-to-vec2.c: New test.
        * gcc.c-torture/execute/scal-to-vec3.c: New test.
        * gcc.dg/scal-to-vec1.c: New test.
        * gcc.dg/scal-to-vec2.c: New test.


But it could also happen that the code is dead. It may be that build_binary_op
or its callers rearrange the operators so VECTOR*SCALAR is always handled as
SCALAR*VECTOR?


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

* [Bug c/53060] Typo in build_binary_op for scalar-vector ops
  2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
  2012-04-21 13:44 ` [Bug c/53060] " manu at gcc dot gnu.org
@ 2012-04-21 15:01 ` marc.glisse at normalesup dot org
  2012-04-23 10:01 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marc.glisse at normalesup dot org @ 2012-04-21 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-21 14:59:54 UTC ---
(In reply to comment #1)
>         * gcc.dg/scal-to-vec2.c: New test.

This one runs the problematic code, but since this is a compile-only test, it
can't detect a problem. A variant that does fail:

extern void abort (void);

int                     f(void) { return 2; }
unsigned int            g(void) { return 5; }
unsigned int            h = 1;

typedef unsigned int vec __attribute__((vector_size(16)));

vec i = { 1, 2, 3, 4};

vec fv1(void) { return i + (h ? f() : g()); }
vec fv2(void) { return (h ? f() : g()) + i; }

int main(){
  vec j = fv1();
  if (j[0] != 3) abort();
}

(it works ok with fv2)


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

* [Bug c/53060] Typo in build_binary_op for scalar-vector ops
  2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
  2012-04-21 13:44 ` [Bug c/53060] " manu at gcc dot gnu.org
  2012-04-21 15:01 ` marc.glisse at normalesup dot org
@ 2012-04-23 10:01 ` rguenth at gcc dot gnu.org
  2012-04-23 10:21 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-23 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-04-23
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-23 10:00:52 UTC ---
Mine.


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

* [Bug c/53060] Typo in build_binary_op for scalar-vector ops
  2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
                   ` (2 preceding siblings ...)
  2012-04-23 10:01 ` rguenth at gcc dot gnu.org
@ 2012-04-23 10:21 ` rguenth at gcc dot gnu.org
  2012-04-23 10:24 ` rguenth at gcc dot gnu.org
  2012-04-23 10:38 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-23 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-23 10:20:13 UTC ---
Author: rguenth
Date: Mon Apr 23 10:20:05 2012
New Revision: 186696

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186696
Log:
2012-04-23  Richard Guenther  <rguenther@suse.de>

    PR c/53060
    * c-typeck.c (build_binary_op): Fix typo.

    * gcc.dg/pr53060.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr53060.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/53060] Typo in build_binary_op for scalar-vector ops
  2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
                   ` (3 preceding siblings ...)
  2012-04-23 10:21 ` rguenth at gcc dot gnu.org
@ 2012-04-23 10:24 ` rguenth at gcc dot gnu.org
  2012-04-23 10:38 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-23 10:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-23 10:24:25 UTC ---
Author: rguenth
Date: Mon Apr 23 10:24:14 2012
New Revision: 186698

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186698
Log:
2012-04-23  Richard Guenther  <rguenther@suse.de>

    PR c/53060
    * c-typeck.c (build_binary_op): Fix typo.

    * gcc.dg/pr53060.c: New testcase.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr53060.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/c-typeck.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c/53060] Typo in build_binary_op for scalar-vector ops
  2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
                   ` (4 preceding siblings ...)
  2012-04-23 10:24 ` rguenth at gcc dot gnu.org
@ 2012-04-23 10:38 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-23 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-23 10:36:28 UTC ---
Fixed.  Thanks for spotting.


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

end of thread, other threads:[~2012-04-23 10:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21 12:09 [Bug c/53060] New: Typo in build_binary_op for scalar-vector ops marc.glisse at normalesup dot org
2012-04-21 13:44 ` [Bug c/53060] " manu at gcc dot gnu.org
2012-04-21 15:01 ` marc.glisse at normalesup dot org
2012-04-23 10:01 ` rguenth at gcc dot gnu.org
2012-04-23 10:21 ` rguenth at gcc dot gnu.org
2012-04-23 10:24 ` rguenth at gcc dot gnu.org
2012-04-23 10:38 ` rguenth 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).