The following code... #include <stdlib.h> extern int *MMAPMON (int m, int *A); extern void MMAPREM (int m, int *A, int *B);
int *MMAPGCD(p,A,B)
int p,*A,*B;
{
int *A1,*A2,*t,*C,m,n;
if (((A[-1]) == 0 && (A[0]) == 0)) {
C = MMAPMON(p,B);
goto Return; }
if (((B[-1]) == 0 && (B[0]) == 0)) {
C = MMAPMON(p,A);
goto Return; }
m = (A[-1]);
n = (B[-1]);
if (m >= n) {
A1 = MMAPMON(p,A);
A2 = MMAPMON(p,B); }
else {
A1 = MMAPMON(p,B);
A2 = MMAPMON(p,A); }
do {
MMAPREM(p,A1,A2);
t = A1;
A1 = A2;
A2 = t; }
while (!((A2[-1]) == 0 && (A2[0]) == 0));
C = MMAPMON(p,A1);
free(((A1)-1));
free(((A2)-1));
Return:
return(C);
}
hangs the gcc 4.4.0 and gcc-4_4-branch gcc compiler at -O2 when compiled
with...
gcc-4 -c foo.c -O2 -Wall -Wextra -Wstrict-prototypes -Wstrict- aliasing=2
The problem is observed on i686-apple-darwin9, x86_64-apple-darwin10 and
x86_64-redhat-linux. On x86_64-apple-darwin10, sampling during the hang
shows...
Sampling process 30978 for 1 seconds with 1 millisecond of run time between
samp
les
Sampling completed, processing symbols...
Analysis of sampling cc1 (pid 30978) every 1 millisecond
Call graph:
852 Thread_2d07
852 start
852 toplev_main
852 c_write_global_declarations
852 cgraph_optimize
852 cgraph_expand_function
852 tree_rest_of_compilation
852 execute_pass_list
852 execute_pass_list
852 execute_one_pass
852 do_pre
852 execute_pre
850 compute_antic
359 phi_translate_set
88 sorted_array_from_bitmap_set
76 sorted_array_from_bitmap_set
6 bitmap_bit_p
6 bitmap_bit_p
6 vec_heap_o_reserve_1
6 xrealloc
4 xrealloc
2 malloc
2 malloc_zone_malloc
2 szone_malloc
2 szone_malloc
58 bitmap_insert_into_set_1
36 htab_find_slot_with_hash
17 vn_nary_op_eq
11 types_compatible_p
8 useless_type_conversion_p
4 get_alias_set
4 get_alias_set
4 useless_type_conversion_p
3 types_compatible_p
3 expressions_equal_p
3 expressions_equal_p
3 vn_nary_op_eq
15 htab_find_slot_with_hash
4 pre_expr_eq
4 pre_expr_eq
7 bitmap_set_bit
4 bitmap_set_bit
2 bitmap_element_link
2 bitmap_element_link
1 bitmap_element_allocate
1 bitmap_element_allocate
6 bitmap_insert_into_set_1
4 iterative_hash_hashval_t
4 iterative_hash_hashval_t
2 get_expr_value_id
2 get_expr_value_id
2 htab_find_slot
2 pre_expr_hash
2 pre_expr_hash
1 value_id_constant_p
1 bitmap_bit_p
1 bitmap_bit_p
54 phi_translate_1
35 htab_find_slot_with_hash
16 htab_find_slot_with_hash
11 vn_nary_op_eq
8 types_compatible_p
6 useless_type_conversion_p
4 useless_type_conversion_p
2 get_alias_set
2 get_alias_set
2 types_compatible_p
2 vn_nary_op_eq
1 expressions_equal_p
1 expressions_equal_p
7 pre_expr_eq
7 pre_expr_eq
1 expr_pred_trans_eq
1 expr_pred_trans_eq
10 get_expr_value_id
8 get_expr_value_id
2 VN_INFO
2 VN_INFO
6 phi_translate_1
1 expr_pred_trans_eq
1 expr_pred_trans_eq
1 pre_expr_hash
1 pre_expr_hash
1 value_id_constant_p
1 bitmap_bit_p
1 bitmap_bit_p
42 htab_find_slot_with_hash
20 htab_find_slot_with_hash
17 vn_nary_op_eq
12 types_compatible_p
9 useless_type_conversion_p
6 useless_type_conversion_p
3 get_alias_set
3 get_alias_set
3 types_compatible_p
3 vn_nary_op_eq
2 expressions_equal_p
2 expressions_equal_p
3 expr_pred_trans_eq
3 expr_pred_trans_eq
2 pre_expr_eq
2 pre_expr_eq
27 xmalloc
23 malloc
21 malloc_zone_malloc
18 szone_malloc
10 tiny_malloc_from_free_list
10 tiny_malloc_from_free_list
8 szone_malloc
3 malloc_zone_malloc
2 malloc
4 xmalloc
22 bitmap_value_insert_into_set
13 bitmap_set_contains_value
6 bitmap_set_contains_value
4 bitmap_bit_p
4 bitmap_bit_p
3 value_id_constant_p
2 value_id_constant_p
1 bitmap_bit_p
1 bitmap_bit_p
4 get_expr_value_id
2 VN_INFO
2 VN_INFO
2 get_expr_value_id
3 bitmap_value_insert_into_set
2 value_id_constant_p
1 bitmap_bit_p
1 bitmap_bit_p
1 value_id_constant_p
22 szone_free
22 szone_free
13 iterative_hash_hashval_t
13 iterative_hash_hashval_t
7 phi_translate_set
5 free
5 free
5 phi_translate
3 phi_translate
2 bitmap_clear
2 bitmap_clear
4 pre_expr_hash
4 pre_expr_hash
3 malloc_zone_free
3 malloc_zone_free
2 bitmap_bit_p
2 bitmap_bit_p
2 bitmap_set_bit
1 bitmap_element_allocate
1 bitmap_element_allocate
1 bitmap_set_bit
2 dyld_stub_malloc
2 dyld_stub_malloc
1 expr_pred_trans_eq
1 expr_pred_trans_eq
1 htab_find_slot
1 htab_find_slot
1 vec_heap_o_reserve_1
1 vec_heap_o_reserve_1
110 sorted_array_from_bitmap_set
84 sorted_array_from_bitmap_set
18 vec_heap_o_reserve_1
16 xrealloc
12 malloc
11 malloc_zone_malloc
10 szone_malloc
5 szone_malloc
5 tiny_malloc_from_free_list
5 tiny_malloc_from_free_list
1 malloc_zone_malloc
1 malloc
4 realloc
4 malloc_zone_realloc
3 szone_realloc
2 __memcpy
2 __memcpy
1 szone_malloc
1 szone_malloc
1 memcpy
1 memcpy
1 dyld_stub_malloc
1 dyld_stub_malloc
1 vec_heap_o_reserve_1
8 bitmap_bit_p
8 bitmap_bit_p
76 bitmap_set_subtract
23 bitmap_set_new
12 bitmap_set_new
6 bitmap_obstack_alloc_stat
6 bitmap_obstack_alloc_stat
5 pool_alloc
4 pool_alloc
1 xmalloc
1 malloc
1 malloc_zone_malloc
1 szone_malloc
1 tiny_malloc_from_region_no_lock
1 allocate_pages
1 __mmap
1 __mmap
22 bitmap_set_subtract
12 bitmap_and_compl
10 bitmap_and_compl
2 bitmap_elt_insert_after
2 bitmap_elt_insert_after
10 get_expr_value_id
6 get_expr_value_id
4 VN_INFO
4 VN_INFO
9 bitmap_set_bit
6 bitmap_set_bit
2 bitmap_element_allocate
2 bitmap_element_allocate
1 bitmap_element_link
1 bitmap_element_link
65 bitmap_insert_into_set_1
36 htab_find_slot_with_hash
20 vn_nary_op_eq
16 types_compatible_p
13 useless_type_conversion_p
9 get_alias_set
9 get_alias_set
4 useless_type_conversion_p
3 types_compatible_p
4 vn_nary_op_eq
11 htab_find_slot_with_hash
5 pre_expr_eq
5 pre_expr_eq
8 bitmap_set_bit
6 bitmap_set_bit
1 bitmap_element_allocate
1 bitmap_element_allocate
1 bitmap_element_link
1 bitmap_element_link
5 bitmap_insert_into_set_1
5 get_expr_value_id
4 get_expr_value_id
1 VN_INFO
1 VN_INFO
5 htab_find_slot
2 htab_find_slot
2 pre_expr_hash
2 pre_expr_hash
1 iterative_hash_hashval_t
1 iterative_hash_hashval_t
3 iterative_hash_hashval_t
3 iterative_hash_hashval_t
3 value_id_constant_p
2 value_id_constant_p
1 bitmap_bit_p
1 bitmap_bit_p
56 compute_antic
42 valid_in_sets
15 valid_in_sets
10 htab_find_slot_with_hash
9 htab_find_slot_with_hash
1 pre_expr_eq
1 pre_expr_eq
7 bitmap_set_contains_value
5 bitmap_set_contains_value
1 bitmap_bit_p
1 bitmap_bit_p
1 value_id_constant_p
1 value_id_constant_p
5 iterative_hash_hashval_t
5 iterative_hash_hashval_t
3 bitmap_bit_p
3 bitmap_bit_p
2 htab_find_slot
2 iterative_hash_hashval_t
2 iterative_hash_hashval_t
27 bitmap_value_insert_into_set
10 bitmap_set_contains_value
6 bitmap_set_contains_value
2 bitmap_bit_p
2 bitmap_bit_p
2 value_id_constant_p
2 bitmap_bit_p
2 bitmap_bit_p
7 get_expr_value_id
7 get_expr_value_id
6 bitmap_value_insert_into_set
2 value_id_constant_p
2 bitmap_bit_p
2 bitmap_bit_p
1 VN_INFO
1 VN_INFO
1 bitmap_bit_p
1 bitmap_bit_p
25 szone_free
17 szone_free
8 tiny_free_list_add_ptr
8 tiny_free_list_add_ptr
21 iterative_hash_hashval_t
21 iterative_hash_hashval_t
16 bitmap_set_free
12 bitmap_obstack_free
10 bitmap_elt_clear_from
10 bitmap_elt_clear_from
2 bitmap_obstack_free
4 bitmap_set_free
14 bitmap_set_new
7 bitmap_set_new
5 bitmap_obstack_alloc_stat
5 bitmap_obstack_alloc_stat
2 pool_alloc
2 pool_alloc
10 bitmap_set_and
8 bitmap_set_and
1 bitmap_bit_p
1 bitmap_bit_p
1 bitmap_copy
1 bitmap_copy
9 bitmap_set_bit
6 bitmap_set_bit
2 bitmap_element_link
2 bitmap_element_link
1 bitmap_element_allocate
1 bitmap_element_allocate
7 bitmap_remove_from_set
4 bitmap_clear_bit
4 bitmap_clear_bit
2 bitmap_remove_from_set
1 get_expr_value_id
1 get_expr_value_id
5 free
5 free
2 bitmap_copy
2 bitmap_copy
2 vec_heap_o_reserve_1
2 xrealloc
2 malloc
1 malloc
1 malloc_zone_malloc
1 szone_malloc
1 szone_malloc
1 bitmap_equal_p
1 bitmap_equal_p
1 dyld_stub_malloc_zone_free
1 dyld_stub_malloc_zone_free
1 malloc_zone_free
1 malloc_zone_free
1 vec_heap_p_reserve
1 vec_heap_p_reserve
1 bitmap_insert_into_set_1
1 bitmap_insert_into_set_1
1 dyld_stub_free
1 dyld_stub_free
Total number in stack (recursive counted multiple, when >=5):
16 bitmap_bit_p
8 value_id_constant_p
7 get_expr_value_id
7 iterative_hash_hashval_t
6 szone_malloc
5 VN_INFO
5 bitmap_element_allocate
5 bitmap_set_bit
5 htab_find_slot_with_hash
5 malloc
5 malloc_zone_malloc
5 pre_expr_eq
Sort by top of stack, same collapsed (when >= 5):
sorted_array_from_bitmap_set 160
htab_find_slot_with_hash 71
compute_antic 56
iterative_hash_hashval_t 49
szone_free 39
bitmap_bit_p 37
get_expr_value_id 30
bitmap_set_bit 23
bitmap_set_subtract 22
bitmap_set_new 19
pre_expr_eq 19
get_alias_set 18
useless_type_conversion_p 18
bitmap_set_contains_value 17
szone_malloc 17
tiny_malloc_from_free_list 15
valid_in_sets 15
bitmap_insert_into_set_1 12
vn_nary_op_eq 12
bitmap_obstack_alloc_stat 11
types_compatible_p 11
VN_INFO 10
bitmap_and_compl 10
bitmap_elt_clear_from 10
free 10
bitmap_value_insert_into_set 9
pre_expr_hash 9
bitmap_set_and 8
tiny_free_list_add_ptr 8
phi_translate_set 7
bitmap_element_allocate 6
bitmap_element_link 6
expr_pred_trans_eq 6
expressions_equal_p 6
phi_translate_1 6
pool_alloc 6
value_id_constant_p 6
Sample analysis of process 30978 written to file /dev/stdout
--
Summary: gcc 4.4.0 compiles in infinite loop
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: howarth at nitro dot med dot uc dot edu
GCC build triplet: *-apple-darwin*
GCC host triplet: *-apple-darwin*
GCC target triplet: *-apple-darwin*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39999
