[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1
From: |
Dirk Herrmann |
Subject: |
Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1 |
Date: |
Fri, 8 Jun 2001 12:09:48 +0200 (MEST) |
On 8 Jun 2001, Matthias Koeppe wrote:
> "unif.c", line 1927: a cast does not yield an lvalue
> "unif.c", line 1930: a cast does not yield an lvalue
> "unif.c", line 2019: a cast does not yield an lvalue
(hopefully) fixed.
> While we are at it: I also get
>
> "./eval.c", line 1698: warning: improper pointer/integer combination: op "="
>
> where the constant initializer of scm_debug_opts tries to put a
> SCM_BOOL_T into the unsigned long `val' member of struct scm_option_t.
> Maybe a cast to scm_bits_t would be appropriate here.
Well, I don't know. The Right Thing would probably be to review the
options interface to avoid the current mixing of types.
> The compiler also reports integer overflows:
>
> "goops.c", line 557: warning: integer overflow detected: op "<<"
> "goops.c", line 557: warning: integer overflow detected: op "<<"
> "goops.c", line 576: warning: integer overflow detected: op "<<"
> "goops.c", line 1311: warning: integer overflow detected: op "<<"
> "goops.c", line 2486: warning: integer overflow detected: op "<<"
> "struct.c", line 345: warning: integer overflow detected: op "<<"
>
> They can be resolved by the following patch:
>
> Index: struct.h
> ===================================================================
> RCS file: /cvs/guile/guile-core/libguile/struct.h,v
> retrieving revision 1.37
> diff -u -u -r1.37 struct.h
> --- struct.h 2001/05/27 22:00:03 1.37
> +++ struct.h 2001/06/08 08:54:38
> @@ -72,9 +72,9 @@
>
> typedef size_t (*scm_struct_free_t) (scm_bits_t * vtable, scm_bits_t * data);
>
> -#define SCM_STRUCTF_MASK (0xFFF << 20)
> -#define SCM_STRUCTF_ENTITY (1L << 30) /* Indicates presence of proc slots */
> -#define SCM_STRUCTF_LIGHT (1L << 31) /* Light representation
> +#define SCM_STRUCTF_MASK (0xFFFUL << 20)
> +#define SCM_STRUCTF_ENTITY (1UL << 30) /* Indicates presence of proc slots */
> +#define SCM_STRUCTF_LIGHT (1UL << 31) /* Light representation
> (no hidden words) */
In this case, I think we should wait until scm_t_bits is made into an
unsigned type. Then, instead of writing 0xFFFUL we should probably write
(scm_t_bits) 0xFFF. Currently, as long as scm_t_bits is signed, this
wouldn't solve your problem.
> And, finally, in num2integral.i.c when included for ptrdiff_t:
>
> "../libguile/num2integral.i.c", line 26: warning: integer overflow detected:
> op "<<"
> "../libguile/num2integral.i.c", line 26: warning: integer overflow detected:
> op "<<"
> "../libguile/num2integral.i.c", line 45: warning: integer overflow detected:
> op "<<"
> "../libguile/num2integral.i.c", line 123: warning: integer overflow detected:
> op "<<"
>
> But this only caused by the dirty way PTRDIFF_MIN is computed. The
> following patch helps to avoid the warning; but it's not much cleaner,
> of course:
I have not looked into this one, maybe Michael can help here.
Thanks for the bug reports and patches!
Dirk Herrmann