home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / gcc / bug / 2823 < prev    next >
Encoding:
Text File  |  1992-11-24  |  1.6 KB  |  78 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!lamothe.informatik.uni-dortmund.de!schwab
  3. From: schwab@lamothe.informatik.uni-dortmund.de (Andreas Schwab)
  4. Subject: GCC 2.3.1: bug in combine pass
  5. Message-ID: <9211230954.AA20304@lamothe.informatik.uni-dortmund.de>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: schwab@ls5.informatik.uni-dortmund.de (Andreas Schwab)
  8. Organization: GNUs Not Usenet
  9. Distribution: gnu
  10. Date: Mon, 23 Nov 1992 11:54:11 GMT
  11. Approved: bug-gcc@prep.ai.mit.edu
  12. Lines: 64
  13.  
  14. GCC 2.3.1 (m68k, Atari TT) generates wrong code for this file:
  15.  
  16. ---------- test.c
  17. typedef struct
  18. {
  19.   unsigned short b0, b1, b2, b3;
  20. } four_quarters;
  21.  
  22. four_quarters x;
  23. int a, b;
  24.  
  25. void f (four_quarters j)
  26. {
  27.   b = j.b2;
  28.   a = j.b3;
  29. }
  30. ----------
  31.  
  32. Compiled with: gcc -O -S test.c
  33.  
  34. ---------- test.s
  35. #NO_APP
  36. gcc2_compiled.:
  37. .text
  38.     .even
  39. .globl _f
  40. _f:
  41.     link a6,#0
  42.     movel d2,sp@-
  43.     movel a6@(8),d1
  44.     movel a6@(12),d2
  45.     movel d2,d0
  46.     clrw d0
  47.     swap d0
  48.     movel d0,_b
  49.     clrw _a
  50.     movew d1,_a+2        | <--- should be d2
  51.     movel a6@(-4),d2
  52.     unlk a6
  53.     rts
  54. .comm _x,8
  55. .comm _a,4
  56. .comm _b,4
  57. ----------
  58.  
  59. I suppose that the bug is in combine.c (make_extraction), near line 4630:
  60.  
  61. ----------
  62.       else if (GET_CODE (inner) == REG)
  63.     /* We can't call gen_lowpart_for_combine here since we always want
  64.        a SUBREG and it would sometimes return a new hard register.  */
  65.     new = gen_rtx (SUBREG, tmode, inner,
  66.                (WORDS_BIG_ENDIAN
  67.             && GET_MODE_SIZE (is_mode) > UNITS_PER_WORD
  68.             ? ((GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (tmode))
  69.                / UNITS_PER_WORD)
  70.             : 0));
  71. ----------
  72.  
  73. If `is_mode' is changed to `inner_mode' (in both places), the bug disappears.
  74. --
  75. Andreas Schwab
  76. schwab@ls5.informatik.uni-dortmund.de
  77.  
  78.