public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH gas/m68k] Fix a register range check
@ 2020-03-27 19:25 Gunther Nikl
  2020-03-31  7:31 ` Alan Modra
  2020-04-07 11:07 ` [PATCH 2/4]: moxie: use generic pcrel support Gunther Nikl
  0 siblings, 2 replies; 5+ messages in thread
From: Gunther Nikl @ 2020-03-27 19:25 UTC (permalink / raw)
  To: binutils

Hello!

Building an older binutils version with clang 10 produced an unexpected
warning message: "overlapping comparisons always evaluate to true". And
indeed, a register range check erroneously used a "logical or" instead
of an "and". This bug is still present in master.

Checking the history of tc-m68k.c shows that this particular bug is really
an ancient one. It was introduced with the creation of the bison grammar
for operand parsing in 1995!


Regards,
Gunther Nikl

2020-03-27  Gunther Nikl  <gnikl@justmail.de>

       * config/tc-m68k.c (m68k_ip): Fix range check for index register
       with a suppressed address register.

-- cut --
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 5483f8e017..fef91706c1 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -2794,7 +2797,7 @@ m68k_ip (char *instring)
 		      && opP->index.reg <= ZDATA7)
 		    nextword |= (opP->index.reg - ZDATA0) << 12;
 		  else if (opP->index.reg >= ZADDR0
-			   || opP->index.reg <= ZADDR7)
+			   && opP->index.reg <= ZADDR7)
 		    nextword |= (opP->index.reg - ZADDR0 + 8) << 12;
 		}
 
-- cut --

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

* Re: [PATCH gas/m68k] Fix a register range check
  2020-03-27 19:25 [PATCH gas/m68k] Fix a register range check Gunther Nikl
@ 2020-03-31  7:31 ` Alan Modra
  2020-03-31 19:47   ` Gunther Nikl
  2020-04-07 11:07 ` [PATCH 2/4]: moxie: use generic pcrel support Gunther Nikl
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Modra @ 2020-03-31  7:31 UTC (permalink / raw)
  To: Gunther Nikl; +Cc: binutils

On Fri, Mar 27, 2020 at 08:25:26PM +0100, Gunther Nikl wrote:
>        * config/tc-m68k.c (m68k_ip): Fix range check for index register
>        with a suppressed address register.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH gas/m68k] Fix a register range check
  2020-03-31  7:31 ` Alan Modra
@ 2020-03-31 19:47   ` Gunther Nikl
  2020-04-02  7:59     ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Gunther Nikl @ 2020-03-31 19:47 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Tue, 31 Mar, 2020 18:01:52 +1030, Alan Modra wrote:
>
> On Fri, Mar 27, 2020 at 08:25:26PM +0100, Gunther Nikl wrote:
> >        * config/tc-m68k.c (m68k_ip): Fix range check for index
> > register with a suppressed address register.
> 
> OK.

Please commit, I don't have write access.

Regards,
Gunther Nikl

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

* Re: [PATCH gas/m68k] Fix a register range check
  2020-03-31 19:47   ` Gunther Nikl
@ 2020-04-02  7:59     ` Nick Clifton
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2020-04-02  7:59 UTC (permalink / raw)
  To: Gunther Nikl, Alan Modra; +Cc: binutils

Hi Gunther,

>> OK.
> Please commit, I don't have write access.

Done.

Cheers
  Nick



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

* [PATCH 2/4]: moxie: use generic pcrel support
  2020-03-27 19:25 [PATCH gas/m68k] Fix a register range check Gunther Nikl
  2020-03-31  7:31 ` Alan Modra
@ 2020-04-07 11:07 ` Gunther Nikl
  1 sibling, 0 replies; 5+ messages in thread
From: Gunther Nikl @ 2020-04-07 11:07 UTC (permalink / raw)
  To: binutils

[resent with correct reference]

The moxie target header uses md_pcrel_from, thus the local prototype and
the macro definition for MD_PCREL_FROM_SECTION are not needed.


2020-XX-XX  Gunther Nikl  <gnikl@justmail.de>

	* config/tc-moxie.h (MD_PCREL_FROM_SECTION): Delete define.
	(md_pcrel_from): Remove prototytpe.

diff --git a/gas/config/tc-moxie.h b/gas/config/tc-moxie.h
index 80f7f6c402..a66b60affe 100644
--- a/gas/config/tc-moxie.h
+++ b/gas/config/tc-moxie.h
@@ -36,12 +36,4 @@
 #define md_estimate_size_before_relax(A, B) (as_fatal (_("estimate size\n")), 0)
 #define md_convert_frag(B, S, F)            as_fatal (_("convert_frag\n"))
 
-/* If you define this macro, it should return the offset between the
-   address of a PC relative fixup and the position from which the PC
-   relative adjustment should be made.  On many processors, the base
-   of a PC relative instruction is the next instruction, so this
-   macro would return the length of an instruction.  */
-#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from (FIX)
-extern long md_pcrel_from (struct fix *);
-
 #define md_section_align(SEGMENT, SIZE)     (SIZE)

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

end of thread, other threads:[~2020-04-07 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 19:25 [PATCH gas/m68k] Fix a register range check Gunther Nikl
2020-03-31  7:31 ` Alan Modra
2020-03-31 19:47   ` Gunther Nikl
2020-04-02  7:59     ` Nick Clifton
2020-04-07 11:07 ` [PATCH 2/4]: moxie: use generic pcrel support Gunther Nikl

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).