home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.bug
- Path: sparky!uunet!cis.ohio-state.edu!lamothe.informatik.uni-dortmund.de!schwab
- From: schwab@lamothe.informatik.uni-dortmund.de (Andreas Schwab)
- Subject: GCC 2.3.1: bug in combine pass
- Message-ID: <9211230954.AA20304@lamothe.informatik.uni-dortmund.de>
- Sender: gnulists@ai.mit.edu
- Reply-To: schwab@ls5.informatik.uni-dortmund.de (Andreas Schwab)
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Mon, 23 Nov 1992 11:54:11 GMT
- Approved: bug-gcc@prep.ai.mit.edu
- Lines: 64
-
- GCC 2.3.1 (m68k, Atari TT) generates wrong code for this file:
-
- ---------- test.c
- typedef struct
- {
- unsigned short b0, b1, b2, b3;
- } four_quarters;
-
- four_quarters x;
- int a, b;
-
- void f (four_quarters j)
- {
- b = j.b2;
- a = j.b3;
- }
- ----------
-
- Compiled with: gcc -O -S test.c
-
- ---------- test.s
- #NO_APP
- gcc2_compiled.:
- .text
- .even
- .globl _f
- _f:
- link a6,#0
- movel d2,sp@-
- movel a6@(8),d1
- movel a6@(12),d2
- movel d2,d0
- clrw d0
- swap d0
- movel d0,_b
- clrw _a
- movew d1,_a+2 | <--- should be d2
- movel a6@(-4),d2
- unlk a6
- rts
- .comm _x,8
- .comm _a,4
- .comm _b,4
- ----------
-
- I suppose that the bug is in combine.c (make_extraction), near line 4630:
-
- ----------
- else if (GET_CODE (inner) == REG)
- /* We can't call gen_lowpart_for_combine here since we always want
- a SUBREG and it would sometimes return a new hard register. */
- new = gen_rtx (SUBREG, tmode, inner,
- (WORDS_BIG_ENDIAN
- && GET_MODE_SIZE (is_mode) > UNITS_PER_WORD
- ? ((GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (tmode))
- / UNITS_PER_WORD)
- : 0));
- ----------
-
- If `is_mode' is changed to `inner_mode' (in both places), the bug disappears.
- --
- Andreas Schwab
- schwab@ls5.informatik.uni-dortmund.de
-
-