From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ralf Wildenhues" Newsgroups: gmane.lisp.guile.bugs,gmane.comp.sysutils.autoconf.bugs Subject: Re: bug in check for stack growth direction in _AC_LIBOBJ_ALLOCA Date: Mon, 20 Jun 2011 08:35:12 +0200 Message-ID: <20110620063512.10360@gmx.net> References: <87d3ic92sc.fsf@pobox.com> <4DFD1BAB.40905@cs.ucla.edu> <87oc1todb4.fsf@pobox.com> <4DFEDC29.1040201@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1308551749 20553 80.91.229.12 (20 Jun 2011 06:35:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2011 06:35:49 +0000 (UTC) Cc: bug-guile , bug-autoconf@gnu.org To: Paul Eggert Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jun 20 08:35:45 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QYY5G-0002nu-Bf for guile-bugs@m.gmane.org; Mon, 20 Jun 2011 08:35:42 +0200 Original-Received: from localhost ([::1]:60848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYY5E-00050s-Q3 for guile-bugs@m.gmane.org; Mon, 20 Jun 2011 02:35:40 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYY4r-00050X-5Z for bug-guile@gnu.org; Mon, 20 Jun 2011 02:35:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYY4p-0008W3-N9 for bug-guile@gnu.org; Mon, 20 Jun 2011 02:35:16 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:56691) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QYY4p-0008Vs-0D for bug-guile@gnu.org; Mon, 20 Jun 2011 02:35:15 -0400 Original-Received: (qmail 10557 invoked by uid 0); 20 Jun 2011 06:35:13 -0000 Original-Received: from 77.58.247.232 by www013.gmx.net with HTTP; Mon, 20 Jun 2011 08:35:12 +0200 (CEST) In-Reply-To: <4DFEDC29.1040201@cs.ucla.edu> X-Authenticated: #13673931 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Mutt-Fcc: ~/Mail/outbox X-Mutt-References: <4DFEDC29.1040201@cs.ucla.edu> X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1/PBfpZfzDPUQ+MwMwYEeaoHyD1tDvJmfDZ0PKYaH DDmlXIAfFt0etymyNQkTyuNjyj9Qt8VhUz5g== X-GMX-UID: GdLIBERDQEV/e/yTuXVpZdFCNzg2NcLr X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 213.165.64.22 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5675 gmane.comp.sysutils.autoconf.bugs:7952 Archived-At: Hello Paul, * Paul Eggert wrote on Mon, Jun 20, 2011 at 07:35:37AM CEST: > On 06/19/11 12:01, Andy Wingo wrote: > > No, this program also exhibits the same incorrect behavior, for purposes > > of stack growth checking. > > Thanks, I guess we'll have to turn it up a notch. How about the > following test program? > > int > find_stack_direction (int *addr, int depth) > { > int dir, dummy = 0; > if (! addr) > addr = &dummy; > *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; > dir = depth ? find_stack_direction (addr, depth - 1) : 0; > return dir + dummy; > } > > int > main (int argc, char **argv) > { > return find_stack_direction (0, argc + !argv + 20) < 0; > } If you don't use volatile, the compiler is pretty much free to give you whatever answer it likes today. I'm not sure whether it's required to give the right answer with volatile, given that you're still comparing pointers that C does not allow you to compare, but the above looks more obfuscated than the simplest code using volatile would. Thanks, Ralf