public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56875] New: vax target miscompiles short negative constants for 64bit values
@ 2013-04-08 12:04 martin at netbsd dot org
  2013-09-16 21:06 ` [Bug target/56875] " jbglaw@lug-owl.de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: martin at netbsd dot org @ 2013-04-08 12:04 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56875
           Summary: vax target miscompiles short negative constants for
                    64bit values
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: martin@netbsd.org


Created attachment 29823
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29823
Use the D format specifie for ashqs second arg

The documentation for VAX operand formatting codes says:

   D    64-bit immediate operand

and:

/* The purpose of D is to get around a quirk or bug in vax assembler
   whereby -1 in a 64-bit immediate operand means 0x00000000ffffffff,
   which is not a 64-bit minus one.  */

However, the ashq instruction patters do not use this properly.

This small test program triggers it:

#include <stdio.h>
#include <inttypes.h>

int main(int argc, char **argv)
{
        size_t i;
        uint64_t v, nv;

        for (i = 0; i < 16; i++) {
                v = ~(uint64_t)0 << i;
                nv = ~v;
                printf("%zu: mask %08llx not %08llx\n", i, v, nv);
        }

        return 0;
}

The relevant line from assembly:

    ashq %r6,$-1,%r2

which is misinterpreted by the assembler, so dissasembly is:

   10637:       79 56 8f ff     ashq r6,$0x00000000ffffffff,r2
   1063b:       ff ff ff 00 
   1063f:       00 00 00 52 


The attached patch fixes it.


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

end of thread, other threads:[~2013-09-21  8:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08 12:04 [Bug target/56875] New: vax target miscompiles short negative constants for 64bit values martin at netbsd dot org
2013-09-16 21:06 ` [Bug target/56875] " jbglaw@lug-owl.de
2013-09-17  1:06 ` jbglaw@lug-owl.de
2013-09-17  7:12 ` martin at netbsd dot org
2013-09-17  7:21 ` jbglaw@lug-owl.de
2013-09-20 16:51 ` jbglaw@lug-owl.de
2013-09-20 19:00 ` jbglaw at gcc dot gnu.org
2013-09-21  8:18 ` martin at netbsd 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).