public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23226] New: Nested function do not work on 32 bit build
@ 2005-08-04  6:33 lex dot augusteijn at philips dot com
  2005-08-04  8:07 ` [Bug c/23226] " belyshev at depni dot sinp dot msu dot ru
  0 siblings, 1 reply; 2+ messages in thread
From: lex dot augusteijn at philips dot com @ 2005-08-04  6:33 UTC (permalink / raw)
  To: gcc-bugs

The nice litle program below does not work on 4.0.1 32 bit target code, running
on  an Opteron.
The 64 bit target is OK.

The problem appears on both 3.4.3 and 4.0.1, I did not try other releases.

Regards,

Lex Augusteijn

----------------------------

#include <stdio.h>

typedef enum { FALSE, TRUE } Bool;

Bool false (int x) { return FALSE; }

void primes (int p, Bool (*filter) (int))
{
  int q;
  
  Bool my_filter (int x) 
  {
    return x%p ? filter(x) : TRUE;
  }
  
  printf ("%d\n", p);
  for (q = p+2; my_filter(q); q += 2) {}
  primes (q, my_filter);
}

int main (void)
{
  printf ("%d\n", 2);
  primes (3, false);
  return 0;
}

-- 
           Summary: Nested function do not work on 32 bit build
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lex dot augusteijn at philips dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23226


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

* [Bug c/23226] Nested function do not work on 32 bit build
  2005-08-04  6:33 [Bug c/23226] New: Nested function do not work on 32 bit build lex dot augusteijn at philips dot com
@ 2005-08-04  8:07 ` belyshev at depni dot sinp dot msu dot ru
  0 siblings, 0 replies; 2+ messages in thread
From: belyshev at depni dot sinp dot msu dot ru @ 2005-08-04  8:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From belyshev at depni dot sinp dot msu dot ru  2005-08-04 08:07 -------
This program works for me in both 32 and 64 bit mode.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23226


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

end of thread, other threads:[~2005-08-04  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04  6:33 [Bug c/23226] New: Nested function do not work on 32 bit build lex dot augusteijn at philips dot com
2005-08-04  8:07 ` [Bug c/23226] " belyshev at depni dot sinp dot msu dot ru

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).