Bug 31469 - move_by_pieces in expr.c function bug
Summary: move_by_pieces in expr.c function bug
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: internal-improvement
Depends on:
Blocks:
 
Reported: 2007-04-04 16:12 UTC by omer medan
Modified: 2021-08-16 22:45 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-16 00:00:00


Attachments
Fixes problem (resubmit, lost due to collision) (480 bytes, patch)
2011-02-21 09:51 UTC, Peter A. Bigot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description omer medan 2007-04-04 16:12:51 UTC
The function move_by_pieces in expr.c enters to endless loop when the backend defines the sizes of all data types to be the same size (aka CHAR_TYPE_SIZE	= SHORT_TYPE_SIZE	= INT_TYPE_SIZE = anyvalue …).

The loop itself occurs in this code section - 
while (max_size > 1)
    {
		
      for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
           tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
        if (GET_MODE_SIZE (tmode) < max_size)
          mode = tmode;

      if (mode == VOIDmode)
        break;

      icode = mov_optab->handlers[(int) mode].insn_code;
      if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode))
        move_by_pieces_1 (GEN_FCN (icode), mode, &data);

      max_size = GET_MODE_SIZE (mode);
    }

The idea here is to decrease the sizes of copying insn, or something like that, 
But what if it isn’t decreasing?

Thanks.
Comment 1 Peter A. Bigot 2011-02-21 09:51:24 UTC
Created attachment 23422 [details]
Fixes problem (resubmit, lost due to collision)
Comment 2 Peter A. Bigot 2011-02-21 09:53:10 UTC
(In reply to comment #1)
> Created attachment 23422 [details]
> Fixes problem (resubmit, lost due to collision)

Sorry, bugzilla confused me, this attachment was intended for 42722.
Comment 3 Andrew Pinski 2021-08-16 22:45:35 UTC
>CHAR_TYPE_SIZE	= SHORT_TYPE_SIZE	= INT_TYPE_SIZE
Won't matter in this loop.

what matters is QImode == 1. 

But if the target overrides machmode.def I doubt this can happen
INT_MODE (QI, 1);
INT_MODE (HI, 2);
INT_MODE (SI, 4);
INT_MODE (DI, 8);
INT_MODE (TI, 16);