Discussion:
[Bug gdb/17816] New: gdb/m32c-tdep.c:1244: Same expression in both branches of ternary operator
dcb314 at hotmail dot com
2015-01-08 16:15:58 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17816

Bug ID: 17816
Summary: gdb/m32c-tdep.c:1244: Same expression in both branches
of ternary operator
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: dcb314 at hotmail dot com

From today's trunk of gdb:

[binutils-gdb/gdb/m32c-tdep.c:1244]: (style) Same expression in both branches
of ternary operator.

Source code is

case 0x0: sd.reg = (size == 1 ? &st->r0 : &st->r0); break;

Suggest code rework.
--
You are receiving this mail because:
You are on the CC list for the bug.
simon.marchi at ericsson dot com
2018-08-20 03:43:10 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17816

Simon Marchi <simon.marchi at ericsson dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |simon.marchi at ericsson dot com

--- Comment #1 from Simon Marchi <simon.marchi at ericsson dot com> ---
What tool reported this? I don't know about m32c instruction encoding, so I
don't know if this is an error or not (from the pattern, I would assume not).
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-08-20 08:07:45 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17816

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
IMO if it is correct then it should be simplified, because
as-is it looks like an error; whereas having it be the same
form as the other cases doesn't seem so very important.
--
You are receiving this mail because:
You are on the CC list for the bug.
simon.marchi at ericsson dot com
2018-08-20 14:34:48 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17816

--- Comment #3 from Simon Marchi <simon.marchi at ericsson dot com> ---
Patch sent: https://sourceware.org/ml/gdb-patches/2018-08/msg00464.html
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-08-21 14:49:58 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17816

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a4497d2f8486502ab5140ec5168d5f13ec375155

commit a4497d2f8486502ab5140ec5168d5f13ec375155
Author: Simon Marchi <***@ericsson.com>
Date: Tue Aug 21 10:47:47 2018 -0400

Remove unnecessary ternary operator in m32c-tdep.c

Bug 17816 pointed out a useless use of the ternary operator:

case 0x0: sd.reg = (size == 1 ? &st->r0 : &st->r0); break;

I believe that this is right. If size is 1, the instruction refers to
part of r0, while if size is 2, the instruction refers to the whole of
r0.

gdb/ChangeLog:

PR gdb/17816
* m32c-tdep.c (m32c_decode_srcdest4): Remove unnecessary ternary
operator.
--
You are receiving this mail because:
You are on the CC list for the bug.
simon.marchi at ericsson dot com
2018-08-21 15:01:29 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=17816

Simon Marchi <simon.marchi at ericsson dot com> changed:

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

--- Comment #5 from Simon Marchi <simon.marchi at ericsson dot com> ---
Fixed by the commit mentioned above.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...