This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

other/10182: wrong conversion [unsigned -> double] with [-masm=intel]


>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 dot mauhart at chello dot 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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]