public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints
@ 2012-05-15 1:05 svfuerst at gmail dot com
2012-05-15 1:42 ` [Bug c/53353] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: svfuerst at gmail dot com @ 2012-05-15 1:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53353
Bug #: 53353
Summary: Missing error/warning when using __int128_t with
incorrect asm register constraints
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: svfuerst@gmail.com
The following (nonsensical) code should give an error (or at least a warning)
about the 128 bit type not fitting into a register:
void foo(__int128_t x)
{
asm("mov %0, bar":: "r" (x));
}
Instead, the above compiles into an instruction that uses the 16 bit register
%ax.
(Compiled with -Wall -W)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/53353] Missing error/warning when using __int128_t with incorrect asm register constraints
2012-05-15 1:05 [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints svfuerst at gmail dot com
@ 2012-05-15 1:42 ` pinskia at gcc dot gnu.org
2012-05-15 2:03 ` svfuerst at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-15 1:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53353
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-15 01:40:11 UTC ---
It fits into two registers, rax and rbx.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/53353] Missing error/warning when using __int128_t with incorrect asm register constraints
2012-05-15 1:05 [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints svfuerst at gmail dot com
2012-05-15 1:42 ` [Bug c/53353] " pinskia at gcc dot gnu.org
@ 2012-05-15 2:03 ` svfuerst at gmail dot com
2012-05-15 2:04 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: svfuerst at gmail dot com @ 2012-05-15 2:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53353
--- Comment #2 from Steven Fuerst <svfuerst at gmail dot com> 2012-05-15 01:54:46 UTC ---
Obviously a __int128_t fits in two registers. The bug is that gcc doesn't
warn/error about code mistakenly trying to fit it into one. Instead, gcc
generates a weird 16-bit operation, causing silent bad code generation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/53353] Missing error/warning when using __int128_t with incorrect asm register constraints
2012-05-15 1:05 [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints svfuerst at gmail dot com
2012-05-15 1:42 ` [Bug c/53353] " pinskia at gcc dot gnu.org
2012-05-15 2:03 ` svfuerst at gmail dot com
@ 2012-05-15 2:04 ` pinskia at gcc dot gnu.org
2012-05-15 2:15 ` svfuerst at gmail dot com
2012-05-15 7:40 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-15 2:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53353
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-15 02:02:23 UTC ---
(In reply to comment #2)
> Obviously a __int128_t fits in two registers. The bug is that gcc doesn't
> warn/error about code mistakenly trying to fit it into one. Instead, gcc
> generates a weird 16-bit operation, causing silent bad code generation.
It does not know what you want to do? Really it is the "ax:dx" pair most
likely.
Also the inline-asm uses internal GCC representation.
How does GCC not know the inline-asm did the correct thing of what the user
wanted it to do? Hint GCC cannot read your mind to say you made a mistake
here.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/53353] Missing error/warning when using __int128_t with incorrect asm register constraints
2012-05-15 1:05 [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints svfuerst at gmail dot com
` (2 preceding siblings ...)
2012-05-15 2:04 ` pinskia at gcc dot gnu.org
@ 2012-05-15 2:15 ` svfuerst at gmail dot com
2012-05-15 7:40 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: svfuerst at gmail dot com @ 2012-05-15 2:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53353
--- Comment #4 from Steven Fuerst <svfuerst at gmail dot com> 2012-05-15 02:09:05 UTC ---
Actually, it is the rax:rdx pair that is most likely. ax:dx only has 32 bits.
rax:rdx is specified by the 'A' constraint, the only gpr option that is 128
bits.
(Yes, it would be nice to pass a 128 bit integer in some other pair of
registers as an enhancement, but currently only the 'A' constraint works.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/53353] Missing error/warning when using __int128_t with incorrect asm register constraints
2012-05-15 1:05 [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints svfuerst at gmail dot com
` (3 preceding siblings ...)
2012-05-15 2:15 ` svfuerst at gmail dot com
@ 2012-05-15 7:40 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-15 7:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53353
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-15 06:19:51 UTC ---
You are wrong. "A" class contains the ax and dx registers, which means that
for say 64-bit value it can give you either %rax, or %rdx, for 128-bit value
obviously only %rax:%rdx pair. But "r" class contains all the non-fixed
general purpose registers, so it can give you any pair of consecutive
registers.
The only classes that can't hold 128-bit values are the single register
classes, like "a", "b", ..., "D", "S", etc.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-15 6:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-15 1:05 [Bug c/53353] New: Missing error/warning when using __int128_t with incorrect asm register constraints svfuerst at gmail dot com
2012-05-15 1:42 ` [Bug c/53353] " pinskia at gcc dot gnu.org
2012-05-15 2:03 ` svfuerst at gmail dot com
2012-05-15 2:04 ` pinskia at gcc dot gnu.org
2012-05-15 2:15 ` svfuerst at gmail dot com
2012-05-15 7:40 ` jakub at gcc dot gnu.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).