public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: markus.mauhart@chello.at
To: gcc-gnats@gcc.gnu.org
Subject: other/10182: wrong conversion [unsigned -> double] with [-masm=intel]
Date: Fri, 21 Mar 2003 13:26:00 -0000	[thread overview]
Message-ID: <20030321132016.4908.qmail@sources.redhat.com> (raw)


>Number:         10182
>Category:       other
>Synopsis:       wrong conversion [unsigned -> double] with [-masm=intel]
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 21 13:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     markus.mauhart@chello.at
>Release:        gcc version 3.2 20020927 (prerelease)
>Organization:
>Environment:
cygwin under winXP, AMD Duron
>Description:
When using option "-masm=intel", then all conversions from unsigned u (with u>=0x8000 (32768)) to double fail. One effect then is that all conversions from "[U]LONGLONG" to double fail for x>0x8000.
This is with C and C++ code.
>How-To-Repeat:
Compile 123.c like ...
   gcc -v -save-temps -masm=intel -o 123.exe -g 123.c
... and then run 123.exe: it then displays correct conversions (all signed -> double) and incorrect conversions (all unsigned>=32768)

//file 123.c
#include <stdio.h>

int main (int x,char const* const y[])
    {
    unsigned int u = 0x4000		;
    for ( ;u ;u*=2)
	{
	int	i			;
	double	du			;
	double	di			;

	i = --u , du = u , di = i	;
	printf ("u=% 8x, double(u)=% 14.1f, i=int(u)=% 11i, double(i)=% 14.1f\n"
		,u ,du ,i ,di)		;

	i = ++u , du = u , di = i	;
	printf ("u=% 8x, double(u)=% 14.1f, i=int(u)=% 11i, double(i)=% 14.1f\n"
		,u ,du ,i ,di)		;
	}
    return 0				;
    }
>Fix:
AFAIK the only workaround is to remove the option [-masm=intel]
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-03-21 13:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-21 13:26 markus.mauhart [this message]
2003-03-21 13:55 paolo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030321132016.4908.qmail@sources.redhat.com \
    --to=markus.mauhart@chello.at \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).