* Cyprien LAPLACE:
>> This is still undefined. If you need machine address arithmetic, you
>> should use uintptr_t and hope for the best.
> Does it mean that the loop indexed on an integer should become an
> infinite loop ?
Not necessarily. However, the compiler may assume that foo() performs
Florian Weimer a écrit :
* Cyprien LAPLACE:
Hum, well .. another sample test:
/* c.c */
extern void func(void*);
void test()
{
register char (*foo)[32] = (typeof(foo))0-1024;
register int index;
for(index=0;index<1024;index++) {
func(foo++);
}
}
This is stil
* Cyprien LAPLACE:
> Hum, well .. another sample test:
>
> /* c.c */
>
> extern void func(void*);
>
> void test()
> {
> register char (*foo)[32] = (typeof(foo))0-1024;
> register int index;
> for(index=0;index<1024;index++) {
> func(foo++);
> }
> }
This is still undefined.
Hum, well .. another sample test:
/* c.c */
extern void func(void*);
void test()
{
register char (*foo)[32] = (typeof(foo))0-1024;
register int index;
for(index=0;index<1024;index++) {
func(foo++);
}
}
gives, in x86_32:
$ gcc-4.3 -c c.c -O3 && objdump -d c.o
c.o: f
On Thu, Mar 27, 2008 at 12:33:58AM +0100, Cyprien LAPLACE wrote:
> /* b.c */
>
> int main()
> {
> register long foo = 0;
"signed long". Signed integer values have no overflow behaviour in C.
Use "unsigned long" if you want that.
> do {
>asm volatile("nop"::"r"(foo));
> } while(++foo);
Ca
/* b.c */
int main()
{
register long foo = 0;
do {
asm volatile("nop"::"r"(foo));
} while(++foo);
return 0;
}
which gives with gcc-4.3 -O2 -c b.c:
b.o: file format elf64-x86-64
Disassembly of section .text:
:
0: 31 c0 xor%eax,%eax
2
/* b.c */
int main()
{
register long foo = 0;
do {
asm volatile("nop"::"r"(foo));
} while(++foo);
return 0;
}
which gives with gcc-4.3 -O2 -c b.c:
b.o: file format elf64-x86-64
Disassembly of section .text:
:
0: b8 00 00 00 00 mov$0x0,%eax
5:
7 matches
Mail list logo