Project

General

Profile

Actions

Bug #440

closed

Need fresh GCC 4.6: g++ can not compile large 'switch' statement

Added by Dmitry S. about 11 years ago. Updated over 10 years ago.

Status:
Completed
Priority:
Normal
Assignee:
Alexander Z.
Category:
-
Target version:
Start date:
10/16/2013
Due date:
% Done:

100%

Estimated time:
CPU Architecture:
armeabi
Host OS:
Windows
Toolchain:
gcc-4.6
Android version:
CrystaX NDK Version:

Description

r8-crystax-1\toolchains\arm-linux-androideabi-4.6\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe

When compiling large 'switch' statement error occurs: Assembler Error: branch out of range

switch (id) {
case 1: call_fn_a(); break;
case 2: call_fn_b(); break;
case 3: call_fn_c(); break;
...
case 15: call_fn_xxx(); break;
}

Workaround: split 'switch' into small parts:

switch (id) {
case 1: call_fn_a(); break;
case 2: call_fn_b(); break;
case 3: call_fn_c(); break;
...
case 7: call_fn_fff(); break;
}
switch (id) {
case 8: call_fn_ggg(); break;
...
case 15: call_fn_xxx(); break;
}

Actions #1

Updated by Dmitry M. over 10 years ago

  • Priority changed from Low to Normal
Actions #2

Updated by Alexander Z. over 10 years ago

  • Assignee set to Alexander Z.
Actions #3

Updated by Dmitry M. over 10 years ago

  • Target version set to 10.0.0
Actions #4

Updated by Alexander Z. over 10 years ago

  • Status changed from Open to In Progress
Actions #5

Updated by Alexander Z. over 10 years ago

  • Status changed from In Progress to Completed
  • % Done changed from 0 to 100

Big switch compiles without problems now.
See tests/build/crystax-issue-440-big-switch.

Actions

Also available in: Atom PDF