home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / gnu / gcc / bug / 2297 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.5 KB  |  74 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!ia3.u-strasbg.fr!francour
  3. From: francour@ia3.u-strasbg.fr (DEA)
  4. Subject: (none)
  5. Message-ID: <9209091411.AA00522@ia3>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Wed, 9 Sep 1992 18:11:38 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 61
  12.  
  13. Bugs in GCC 2.2
  14.  
  15.  
  16. I used GCC version 2.2 (for my own use only) for several
  17. months, and discovered a problem when passing parameters
  18. notably float parameters. Just look at the two following
  19. small programs, they seems to be similiar, compile them,
  20. run them, compare their result and drop me a line if I'm
  21. wrong.
  22.  
  23.  
  24. /* file f1.c */
  25.  
  26.  
  27. void print_args(float, float, float);
  28.  
  29. main()
  30. {
  31.  print_args(1.0, 67.89, 3.141592654);
  32. }
  33.  
  34. /* end of file f1.c */
  35.  
  36.  
  37. /*file f2.c */
  38.  
  39. #ifdef NORM 
  40.  
  41. void print_args(float a, float b, float c)
  42. {
  43.  printf("a = %f  b = %f   c = %f\n", (double)a, (double)b, (double)c);
  44. }
  45.  
  46. #else
  47.  
  48. void print_args(a, b, c)
  49. float a, b, c; 
  50. {
  51.  printf("a = %f  b = %f   c = %f\n", (double)a, (double)b, (double)c);
  52. }
  53. #endif
  54.  
  55. /* end of file f2.c */
  56.  
  57.  
  58. /*********** Now these are the two programs *******/
  59.  
  60. program 1: gcc -o prog1 f1.c f2.c
  61. program 2: gcc -o prog2 -DNORM f1.c f2.c
  62.  
  63. Now run prog1 as result I've got "a = 0.007813  b = 50.123871   c = 0.000000"
  64. but not "a = 1.0  b = 67.89  c = 3.141592654" expected.
  65. prog2 give me the correct result.
  66.  
  67.  
  68. Please give me answer if you can understand this.
  69.  
  70. Friendly,
  71. FRANCOURT Daniel
  72. francour@ia3.u-strasbg.fr
  73.  
  74.