Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12482 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18523 invoked by uid 1010); 30 Aug 2004 19:38:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 91699 invoked from network); 30 Aug 2004 19:33:04 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 30 Aug 2004 19:33:04 -0000 Received: (qmail 10829 invoked from network); 30 Aug 2004 19:33:02 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 30 Aug 2004 19:33:02 -0000 Message-ID: <5.1.0.14.2.20040830115720.043545d0@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Mon, 30 Aug 2004 12:32:59 -0700 To: Joe Orton ,internals@lists.php.net In-Reply-To: <20040827122550.GC29943@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] [PATCH] zend_operators DVAL_TO_LVAL fix From: andi@zend.com (Andi Gutmans) References: <20040827122550.GC29943@redhat.com> Hi Joe, It seems like your patch doesn't really fix anything. How is rounding to LONG_MAX/LONG_MIN any better? Maybe you can explain in more detail what this gcc bug you are hitting is? Thanks, Andi At 01:25 PM 8/27/2004 +0100, Joe Orton wrote: >The DVAL_TO_LVAL macro is quite weird, I'm not sure exactly what it's >supposed to be doing but it probably isn't doing it. If the integral >part of d is outside the range of a long, the conversion has undefined >behaviour by the C99 standard; an explicit cast makes no difference >AFAICT. > >GCC on IA64 does wierd things with this macro, though I think there's a >GCC bug involved there too. This fixes the macro to have well-defined >behaviour for all values of 'd', and avoids triggering the GCC bug on >IA64 to boot (both PHP users on that platform will be happy): > >Index: Zend/zend_operators.c >=================================================================== >RCS file: /repository/ZendEngine2/zend_operators.c,v >retrieving revision 1.194 >diff -u -r1.194 zend_operators.c >--- Zend/zend_operators.c 19 Jul 2004 07:19:02 -0000 1.194 >+++ Zend/zend_operators.c 27 Aug 2004 12:15:12 -0000 >@@ -183,7 +183,15 @@ > } > > >-#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : >(long) (d) >+#define DVAL_TO_LVAL(d, l) do { \ >+ if ((d) > LONG_MAX) { \ >+ l = LONG_MAX; \ >+ } else if ((d) < LONG_MIN) { \ >+ l = LONG_MIN; \ >+ } else { \ >+ l = (d); \ >+ } \ >+} while (0) > > #define zendi_convert_to_long(op, holder, > result) \ > if (op==result) > { > \ > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php