From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: GCC BUG & 64-BIT INTEGERS PROBLEMS Date: Sun, 09 Apr 2000 02:38:23 +0400 Organization: MTU-Intel ISP Lines: 80 Message-ID: <38EFB4DF.7AD2BF3C@mtu-net.ru> NNTP-Posting-Host: ppp96-214.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------4AA3A63C5F80C9D3D20AA115" X-Trace: gavrilo.mtu.ru 955234691 98132 212.188.96.214 (8 Apr 2000 22:58:11 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 8 Apr 2000 22:58:11 GMT X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en,ru To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. --------------4AA3A63C5F80C9D3D20AA115 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Hi guys! I think I've found a real bug in GCC. I define two 64-bit integer values as folows: --------8<-------- long long A, B; --------8<-------- then I assign something to them (actually I call a routine that stores there 64-bit results of the RDTSC CPU instruction). Then I try to shift these A and B values right: --------8<-------- A>>=32; B>>=33; --------8<-------- But GCC generates the following faulty code (see attached screenshot from builtin RHIDE debugger/disassembler). This means GCC doesn't handle shifts right properly. Shifts left seems to be okay. Addition and subtraction also work fine. I've not tested multiplication and division, but there is a non-zero probabilty that this can be faulty as well as shifts right. Btw, is it possible to printf() 64-bit integers as well as 32-bit? How to make RHIDE supporting 64-bit values too? Ah.... Completely forgot... I use "gcc version 2.95.2 19991024 (release)" and "This is RHIDE Version 1.4.7.5. Modified by A.Pavenis (Feb 8 2000 12:00:51)". Any ideas??? Thanks. Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru --------------4AA3A63C5F80C9D3D20AA115 Content-Type: text/plain; charset=koi8-r; name="SCR_0000.TXT" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="SCR_0000.TXT" êî[À]îîîîîîîîîîîîîîîîîîîîîîîî Disassembler window îîîîîîîîîîîîîîîîîîîîîîî4î[]î» º 00005918: mov 0xffffffcc(%ebp),%eax eax 00000011º º 0000591b: mov 0xffffffd0(%ebp),%edx Àecx 00000035º º 0000591e: mov %eax,%ecx ±edx 00005464º º 00005920: mov %edx,%ebx ±ebx 00008311º º 00005922: mov %ebx,%ecx ±esp 000cff98º º 00005924: sar $0x1f,%ebx ±ebp 000cffe0º º 00005927: mov %ecx,0xffffffcc(%ebp) ±esi 00000054º º 0000592a: mov %ebx,0xffffffd0(%ebp) ±edi 0001f41cº º 0000592d: mov 0xffffffc4(%ebp),%eax ±eip 00005918º º 00005930: mov 0xffffffc8(%ebp),%edx ±eflags 00000202º º 00005933: mov %eax,%ecx ±cs 0117º º 00005935: mov %edx,%ebx ±ss 011fº º 00005937: mov %ebx,%ecx ±ds 011fº º 00005939: sar $0x1f,%ebx ±es 011fº º 0000593c: sar $0x1,%ecx ±fs 010fº º 0000593f: mov %ecx,0xffffffc4(%ebp) ±gs 012fº º 00005942: mov %ebx,0xffffffc8(%ebp) ± º º²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² º éîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîäý --------------4AA3A63C5F80C9D3D20AA115--