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]

target/9620: left-shift of bit field of 64-bit long truncated to 32 bits.


>Number:         9620
>Category:       target
>Synopsis:       left-shift of bit field of 64-bit long truncated to 32 bits.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 07 22:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Mark Young
>Release:        gcc version 3.2.1 ia64-unknown-linux
>Organization:
>Environment:
Linux 2.4.18-e.12smp #1 SMP Thu Oct 17 15:13:01 EDT 2002 ia64 unknown
>Description:
The result of a left-shift on a bit field of a 64-bit unsigned long is truncated to 32 bits, even if the field reference is cast to unsigned long.
>How-To-Repeat:
% gcc -v gcc321bug.c
Reading specs from /usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/specs
Configured with: ./configure --prefix=/usr/local : (reconfigured) ./configure --prefix=/usr/local : (reconfigured) ./configure --prefix=/usr/local
Thread model: posix
gcc version 3.2.1
 /usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__GXX_ABI_VERSION=102 -D__gnu_linux__ -D__linux -D__linux__ -D_LONGLONG -Dlinux -Dunix -D__gnu_linux__ -D__linux -D__linux__ -D_LONGLONG -D__linux__ -D__unix__ -D__linux -D__unix -Asystem=linux -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=ia64 -Amachine=ia64 -D__ia64 -D__ia64__ -D_LP64 -D__LP64__ -D__ELF__ -D__LONG_MAX__=9223372036854775807L gcc321bug.c -quiet -dumpbase gcc321bug.c -version -o /tmp/ccoMhwIv.s
GNU CPP version 3.2.1 (cpplib) (IA-64) Linux
GNU C version 3.2.1 (ia64-unknown-linux)
	compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.2 2.96-108.1).
ignoring nonexistent directory "/usr/local/ia64-unknown-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/include
 /usr/include
End of search list.
 as --traditional-format -x -o /tmp/ccQ3UVgU.o /tmp/ccoMhwIv.s
 /usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/collect2 -dynamic-linker /lib/ld-linux-ia64.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/crtbegin.o -L/usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1 -L/usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/../../.. /tmp/ccQ3UVgU.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/local/lib/gcc-lib/ia64-unknown-linux/3.2.1/crtend.o /usr/lib/crtn.o

% a.out
45640000
45640000
12345640000

output should be:
12345640000
12345640000
12345640000
>Fix:
0x40000000000006a1 <main+129>: extr.u r14=r14,0,23;;
0x40000000000006a2 <main+130>: dep.z r15=r14,18,14
                *** should be: dep.z r15=r14,18,46 ***
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gcc321bug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gcc321bug.c"

LyogVGhlIHJlc3VsdCBvZiBhIGxlZnQtc2hpZnQgb24gYSBiaXQgZmllbGQgb2YgYSA2NC1iaXQg
dW5zaWduZWQgbG9uZyBpcwogKiB0cnVuY2F0ZWQgdG8gMzIgYml0cywgZXZlbiBpZiB0aGUgZmll
bGQgcmVmZXJlbmNlIGlzIGNhc3QgdG8gdW5zaWduZWQgbG9uZy4KICovCgppbnQgbWFpbihpbnQg
YXJnYywgY2hhciAqYXJndltdKQp7CiAgICBzdHJ1Y3QgYm5kbF8gewogICAgICAgIC8qIGxpdHRs
ZS1lbmRpYW4gbGF5b3V0ICovCiAgICAgICAgdW5zaWduZWQgbG9uZyB0bXBsdCAgIDogNTsKICAg
ICAgICB1bnNpZ25lZCBsb25nIHNsb3QwICAgOiA0MTsKICAgICAgICB1bnNpZ25lZCBsb25nIHNs
b3QxbG8gOiAxODsKICAgICAgICB1bnNpZ25lZCBsb25nIHNsb3QxaGkgOiAyMzsKICAgICAgICB1
bnNpZ25lZCBsb25nIHNsb3QyICAgOiA0MTsKICAgIH0geDsKICAgIHVuc2lnbmVkIGxvbmcgc2xv
dDFoaTsKCiAgICB4LnNsb3QxaGkgPSAweDEyMzQ1Njc4OWFiVUwgPj4gMTg7CgogICAgLyogaW4g
dGhlc2UgY2FzZXMgdGhlIGxlZnQgc2hpZnQgZXhwcmVzc2lvbiBpcyB0cnVuY2F0ZWQgKi8KICAg
IHByaW50ZigiJWx4XG4iLCB4LnNsb3QxaGk8PDE4KTsKICAgIHByaW50ZigiJWx4XG4iLCAoKHVu
c2lnbmVkIGxvbmcpeC5zbG90MWhpKTw8MTgpOwoKICAgIC8qIHRoaXMgd29ya3MgY29ycmVjdGx5
ICovCiAgICBzbG90MWhpID0geC5zbG90MWhpOwogICAgcHJpbnRmKCIlbHhcbiIsIHNsb3QxaGk8
PDE4KTsKCiAgICAvKiBpbmNvcnJlY3Qgb3V0cHV0OgogICAgICogNDU2NDAwMDAKICAgICAqIDQ1
NjQwMDAwCiAgICAgKiAxMjM0NTY0MDAwMAogICAgICoKICAgICAqIGNvcnJlY3Qgb3V0cHV0Ogog
ICAgICogMTIzNDU2NDAwMDAKICAgICAqIDEyMzQ1NjQwMDAwCiAgICAgKiAxMjM0NTY0MDAwMAog
ICAgICovCn0K


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