------- Comment #7 from eblot dot ml at gmail dot com  2010-06-17 09:34 -------
(In reply to comment #5)
> Could you please first try to reproduce the bug with the
> -fno-tree-switch-conversion swithch? 

Using GCC 4.5.0 (tarball)

With -fno-tree-switch-conversion switch option switch, the bug does not appear.
Here is the assembly code:

        .cpu arm926ej-s
        .fpu softvfp
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 1
        .eabi_attribute 30, 2
        .eabi_attribute 18, 4
        .file   "gcc-44328.c"
        .text
        .align  2
        .global _Z9open_filePKc8OpenMode
        .type   _Z9open_filePKc8OpenMode, %function
_Z9open_filePKc8OpenMode:
        .fnstart
.LFB0:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        cmp     r1, #2
        moveq   r1, #3
        beq     .L2
        movhi   r1, #75
        bls     .L8
.L2:
        b       open
.L8:
        cmp     r1, #1
        moveq   r1, #74
        movne   r1, #1
        b       .L2
.LFE0:
        .cantunwind
        .fnend
        .size   _Z9open_filePKc8OpenMode, .-_Z9open_filePKc8OpenMode
        .ident  "GCC: 4.5.0"

> If that helps, the bug is indeed
> in the lookup table generation and then I would like you to provide
> the dump files generated by switches -fdump-tree-tailr1-slim
> -fdump-tree-switchconv  

tailr1:


;; Function void open_file(const char*, OpenMode) (_Z9open_filePKc8OpenMode)

void open_file(const char*, OpenMode) (const char * filename, const OpenMode
rw)
{
  int mode;

<bb 2>:
  switch (rw_3(D)) <default: <L1>, case 1: <L5>, case 2: <L2>, case 3: <L3>>

<L1>:
  goto <bb 6> (<L5>);

<L2>:
  goto <bb 6> (<L5>);

<L3>:

  # mode_1 = PHI <74(2), 1(3), 3(4), 75(5)>
<L5>:
  open (filename_9(D), mode_1);
  return;

}

switchconv:


;; Function void open_file(const char*, OpenMode) (_Z9open_filePKc8OpenMode)

beginning to process the following SWITCH statement (gcc-44328.c:20) : ------- 
switch (rw_3(D)) <default: <L1>, case 1: <L5>, case 2: <L2>, case 3: <L3>>

Removing basic block 3
Removing basic block 5
Removing basic block 4
Removing basic block 9
Switch converted
--------------------------------


Symbols to be put in SSA form

{ .MEM }


Incremental SSA update started at block: 0

Number of blocks in CFG: 10
Number of blocks to update: 5 ( 50%)



void open_file(const char*, OpenMode) (const char * filename, const OpenMode
rw)
{
  char csui.2;
  const OpenMode csti.0;
  int mode;

<bb 2>:
  csui.2_6 = (char) rw_3(D);
  csui.2_5 = csui.2_6 + 255;
  if (csui.2_5 <= 2)
    goto <bb 8> (<L7>);
  else
    goto <bb 7> (<L6>);

<L6>:
  mode_4 = 1;
  goto <bb 6> (<L8>);

<L7>:
  csti.0_8 = rw_3(D) + 255;
  mode_7 = CSWTCH.1[csti.0_8];

  # mode_1 = PHI <mode_7(8), mode_4(7)>
<L8>:
<L5>:
  open (filename_9(D), mode_1);
  return;

}

Let me know if you still need me to apply your patch or if the above info is
enough to understand the issue. I'll need some extra time to rebuild the
compiler.

Thanks for your help.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44328

Reply via email to