Bug in stdio using dynamic reent:

Likely, Grant Grant.Likely@gdcanada.com
Mon Mar 31 20:09:00 GMT 2003


I've compiled newlib with __getreent() commented out and __DYNAMIC_REENT__
and REENTRANT_SYSCALLS_PROVIDED defined.  If I link it with the following
code, then the putchar and printf output is out of order.  I've confirmed
that this is broken on two different target platforms; powerpc and coldfire.
Has anyone else run into this behaviour?

Thanks,
g.

b0VIM
6.1      Y½EUR>¿? ³l  glikely                                 beeblebrox.b
owman.gdcanada.com          ~glikely/gdc-working/testapp/main.c             
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                3210#"!
U                                                                         
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                        tp ÿ      l                     
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                ad  ?  J     l   ¸  ¶  
  z  ...  f  i  g  F  D      Ý  Û  Ì  Ê  ~  Q  
  
  Ô
  Ó
  °
  Y
  |
  i
  U
  B
  A
  '
  
  
  
   
  ê  æ  ¸  S  _  ^  >  <     
  
      î
  ß
  Ð
  ½
  «
  -
  EUR
  ~
  }
  e
  c
  M
  2
  

  
  ì
  Æ
  °
  ®
  
  >
  OE
  <
  |
  {
  F
  #
  ú	  Ò	  À	  ¿	  	  p	  G	  	  
	  
  Ý  ½  "  l  Z  Y  $    Ø  °    oe  f  C  /  ù  Ù  Å  
  o  [  M  K  J  I                                                   
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                          }     while(1); 
fflush(stdout);     curr_impure_ptr = &impure2;     msg = "\r\n----Flushing
default process----\r\n";     fflush(stdout);     curr_impure_ptr =
&impure1;     msg = "\r\n----Flushing default process----\r\n"; 
fflush(stdout);     curr_impure_ptr = _impure_ptr;     msg =
"\r\n----Flushing default process----\r\n";      printtest(12); 
//setvbuf(stdout, NULL, _IONBF, 0);     _write_r(NULL, 0, msg,
strlen(msg));     curr_impure_ptr = _impure_ptr;     msg = "\r\n----Testing
default process----\r\n";      printtest(8);     //setvbuf(stdout, NULL,
_IONBF, 0);     _write_r(NULL, 0, msg, strlen(msg));     curr_impure_ptr =
&impure2;     msg = "\r\n----Testing process 2----\r\n";      printtest(4); 
//setvbuf(stdout, NULL, _IONBF, 0);     _write_r(NULL, 0, msg,
strlen(msg));     curr_impure_ptr = &impure1;     msg = "\r\n----Testing
process 1----\r\n";      printtest(0);     //setvbuf(stdout, NULL, _IONBF,
0);     _write_r(NULL, 0, msg, strlen(msg));     curr_impure_ptr =
_impure_ptr;     msg = "\r\n----Testing default process----\r\n";  
IO_Init();      char *msg; { int main( void ) }     putchar('D'+off); 
printf("And again I say hello!");     putchar('C'+off); 
printf("World!\r\n");     putchar('B'+off);     printf("\r\nHello, "); 
putchar('A'+off); { void printtest(int off)  }     f->_data = _NULL; 
f->_lbfsize = 0;     f->_file = 0;     f->_flags = 0;     f->_w = 0; 
f->_r = 0;     f->_p = _NULL; { void init_file(__FILE *f)  }     return
curr_impure_ptr; { struct _reent *__getreent(void)  struct _reent
*curr_impure_ptr = &impure1; struct _reent impure2 =
_REENT_INIT(impure2); struct _reent impure1 = _REENT_INIT(impure1);  */  *
Reentrancy support /*  int blank_var; int rwvar = 0x5678; const int rovar =
0x1234;  #include <stdio.h> #include <stdlib.h> #include <reent.h> //
******************************* // Include files //
*******************************  *******************************************
***************************/ * *  2001/12/01  1.0         Henk Kroon
Creation *  ----------  ---------   ------------
---------------------------- *  Date        Version     Author
Changes * *  Updated:    * *  Copyright (c) Computing Devices Canada
(2001) *   *  Purpose:    Sample main() for object debugging * *  Project:
BIDS HTS Coldfire * *  Author:     Henk Kroon * *  Date:       Dec, 2001 * *
File:
main.c * /******************************************************************
**** 


More information about the Newlib mailing list