public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* iconv/loop.c vs gcc-3.1: divide by zero in #if
@ 2002-05-16 13:05 Roland McGrath
  2002-05-19 10:03 ` Andreas Jaeger
  0 siblings, 1 reply; 2+ messages in thread
From: Roland McGrath @ 2002-05-16 13:05 UTC (permalink / raw)
  To: GNU libc hackers

Using gcc-3.1 I get "divide by zero in #if" for several iconv modules
without the following change.  Ok to put this in (with log entry, of course)?


Index: loop.c
===================================================================
RCS file: /cvs/glibc/libc/iconv/loop.c,v
retrieving revision 1.28
diff -u -p -r1.28 loop.c
--- loop.c	15 Jul 2001 15:18:22 -0000	1.28
+++ loop.c	16 May 2002 06:24:49 -0000
@@ -1,5 +1,5 @@
 /* Conversion loop frame work.
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998,99,2000,01,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -296,17 +296,19 @@ FCTNAME (LOOPFCT) (struct __gconv_step *
 /* Include the file a second time to define the function to handle
    unaligned access.  */
 #if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \
-    && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
-    && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0
-# undef get16
-# undef get32
-# undef put16
-# undef put32
-# undef unaligned
-
-# define DEFINE_UNALIGNED
-# include "loop.c"
-# undef DEFINE_UNALIGNED
+    && MIN_NEEDED_FROM > 1 && MIN_NEEDED_TO > 1
+# if MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
+#   && MAX_NEEDED_TO % MIN_NEEDED_TO == 0
+#  undef get16
+#  undef get32
+#  undef put16
+#  undef put32
+#  undef unaligned
+
+#  define DEFINE_UNALIGNED
+#  include "loop.c"
+#  undef DEFINE_UNALIGNED
+# endif
 #endif
 
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: iconv/loop.c vs gcc-3.1: divide by zero in #if
  2002-05-16 13:05 iconv/loop.c vs gcc-3.1: divide by zero in #if Roland McGrath
@ 2002-05-19 10:03 ` Andreas Jaeger
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Jaeger @ 2002-05-19 10:03 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU libc hackers

Roland McGrath <roland@frob.com> writes:

> Using gcc-3.1 I get "divide by zero in #if" for several iconv modules
> without the following change.  Ok to put this in (with log entry, of course)?

This just bits me also.  Roland's patch (with the obvious fix) solved
the problem.

I'd like to see this committed soon. 

>
> Index: loop.c
> ===================================================================
> RCS file: /cvs/glibc/libc/iconv/loop.c,v
> retrieving revision 1.28
> diff -u -p -r1.28 loop.c
> --- loop.c	15 Jul 2001 15:18:22 -0000	1.28
> +++ loop.c	16 May 2002 06:24:49 -0000
> @@ -1,5 +1,5 @@
>  /* Conversion loop frame work.
> -   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
> +   Copyright (C) 1998,99,2000,01,02 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>     Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
>  
> @@ -296,17 +296,19 @@ FCTNAME (LOOPFCT) (struct __gconv_step *
>  /* Include the file a second time to define the function to handle
>     unaligned access.  */
>  #if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \
> -    && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
> -    && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0
> -# undef get16
> -# undef get32
> -# undef put16
> -# undef put32
> -# undef unaligned
> -
> -# define DEFINE_UNALIGNED
> -# include "loop.c"
> -# undef DEFINE_UNALIGNED
> +    && MIN_NEEDED_FROM > 1 && MIN_NEEDED_TO > 1
> +# if MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
> +#   && MAX_NEEDED_TO % MIN_NEEDED_TO == 0

Remove the hash here,

Andreas

> +#  undef get16
> +#  undef get32
> +#  undef put16
> +#  undef put32
> +#  undef unaligned
> +
> +#  define DEFINE_UNALIGNED
> +#  include "loop.c"
> +#  undef DEFINE_UNALIGNED
> +# endif
>  #endif
>  
>  
>

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-19 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-16 13:05 iconv/loop.c vs gcc-3.1: divide by zero in #if Roland McGrath
2002-05-19 10:03 ` Andreas Jaeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).