[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Linux off_t casting?
From: |
Ivan Popov |
Subject: |
Re: [Tinycc-devel] Linux off_t casting? |
Date: |
Fri, 15 Jul 2005 16:28:09 +0200 |
User-agent: |
Mutt/1.4.2.1i |
On Thu, Jul 14, 2005 at 09:49:00PM -0700, address@hidden wrote:
> Hmm. Am I doing something wrong here?
>
> The example code below compiles with no warnings using
> "gcc -ansi -pedantic -W -Wextra".
>
> -Charles
>
> address@hidden tcc-apps]$ tcc -v
> tcc version 0.9.23
>
> address@hidden tcc-apps]$ tcc off_t.c
> off_t.c:10: cannot cast 'int' to 'struct <anonymous>'
My try:
$ cat aa.c
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <unistd.h>
int main(void)
{
off_t j;
j = 0; /* cast required */
j++; /* does not work */
j = j + 4; /* casts required */
return 0;
}
$ tcc -o aa aa.c
$ tcc
tcc version 0.9.23 - Tiny C Compiler - Copyright (C) 2001-2005 Fabrice Bellard
...
My environment: Linux, Konvalo.org, glibc 2.3.2, tcc patched with
patch.felix.nawothnig (from tcc-list)
--- tcc.c 17 Apr 2005 13:15:54 -0000 1.170
+++ tcc.c 20 Jun 2005 12:40:18 -0000
@@ -5634,7 +5634,7 @@
/* XXX: currently, some unsigned operations are explicit, so
we modify them here */
if (t & VT_UNSIGNED) {
- if (op == TOK_SAR)
+ if (op == TOK_SAR && (t1 & VT_UNSIGNED))
op = TOK_SHR;
else if (op == '/')
op = TOK_UDIV;
which is most probably irrelevant. I'd rather guess the difference is due to
different includes.
Regards,
--
Ivan