Bug 32772 - [4.3 Regression] error: found real variable when subvariables should have appeared
Summary: [4.3 Regression] error: found real variable when subvariables should have app...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P1 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on: 32032
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-15 23:41 UTC by Adrian Bunk
Modified: 2021-09-09 09:25 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2007-07-16 10:17:40


Attachments
complete error messages (2.54 KB, text/plain)
2007-07-15 23:56 UTC, Adrian Bunk
Details
preprocessed code (136.58 KB, text/plain)
2007-07-15 23:59 UTC, Adrian Bunk
Details
reduced testcase (696 bytes, text/plain)
2007-07-16 10:17 UTC, Richard Biener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Bunk 2007-07-15 23:41:35 UTC
I got the following compile error when trying to compile Linux kernel 2.6.22-rc6-mm1 with a recent gcc SVN snapshot:

$ /usr/local/DIR/gcc-svn20070715/bin/gcc -Wp,-MD,mm/.page_alloc.o.d  -nostdinc -isystem /usr/local/DIR/gcc-svn20070715/lib/gcc/i686-pc-linux-gnu/4.3.0/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Werror-implicit-function-declaration -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=athlon -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -fasynchronous-unwind-tables  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(page_alloc)"  -D"KBUILD_MODNAME=KBUILD_STR(page_alloc)" -c -o mm/page_alloc.o
mm/page_alloc.c: In function ‘__build_all_zonelists’:
mm/page_alloc.c:2381: error: found real variable when subvariables should have appeared
while verifying SSA_NAME used_mask_87 in statement
# node_2_cpu_mask_468 = VDEF <node_2_cpu_mask_640>
# node_data_469 = VDEF <node_data_644>
# zone_reclaim_mode_470 = VDEF <zone_reclaim_mode_648>
# policy_zone_471 = VDEF <policy_zone_652>
# node_load_472 = VDEF <node_load_656>
# node_order_473 = VDEF <node_order_660>
# used_mask_87 = VDEF <used_mask_564>
# tmp_474 = VDEF <tmp_664>
# SFT.3392_475 = VDEF <SFT.3392_668>
# SFT.3393_476 = VDEF <SFT.3393_672>
# SMT.3398_196 = VDEF <SMT.3398_251>
D.24412_7->node_zonelists[i.600_23].zlcache_ptr = zlc_26;
...
Comment 1 Adrian Bunk 2007-07-15 23:56:04 UTC
Created attachment 13917 [details]
complete error messages
Comment 2 Adrian Bunk 2007-07-15 23:59:08 UTC
Created attachment 13918 [details]
preprocessed code
Comment 3 Richard Biener 2007-07-16 10:04:37 UTC
-Os is enough to trigger the problem on x86_64.  (with or without -m32)

Reducing.
Comment 4 Richard Biener 2007-07-16 10:17:22 UTC
Created attachment 13919 [details]
reduced testcase
Comment 5 Richard Biener 2007-07-16 10:17:40 UTC
Confirmed.
Comment 6 Jakub Jelinek 2007-07-16 14:03:05 UTC
Even shorter testcase:

struct S
{
  unsigned long bits[1];
};

void f1 (int, unsigned long *);
int f2 (void);
int f3 (int, unsigned long *);
int f4 (int, unsigned long *);

static inline __attribute__ ((always_inline))
void baz (int x, volatile struct S *y)
{
  f1 (x, y->bits);
}

static int
bar (int x, struct S *y)
{
  int n;
  if (__builtin_constant_p (x) ? f3 (x, y->bits) : f4 (x, y->bits))
    baz (x, y);
  for (n = f2 (); n < 8; n = f2 ())
    f3 (n, y->bits);
}

void
foo (int x, int y)
{
  struct S m;
  while ((y = bar (x, &m)) >= 0);
}
Comment 7 Andrew Pinski 2007-08-04 12:06:33 UTC
I think this is exactly the same as PR 32032, the inliner not setting has_volatile_ops correctly.
Comment 8 Daniel Berlin 2007-08-19 23:23:54 UTC
Subject: Bug 32772

Author: dberlin
Date: Sun Aug 19 23:23:29 2007
New Revision: 127629

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127629
Log:
2007-08-19  Daniel Berlin  <dberlin@dberlin.org>

	Fix PR 32772
	Fix PR 32716
	Fix PR 32328
	Fix PR 32303

	* tree-flow.h (struct stmt_ann_d): Remove makes_clobbering_call.
	* tree-ssa-alias.c (init_transitive_clobber_worklist): Add
	on_worklist argument and avoid adding things to worklist multiple
	times.
	(add_to_worklist): Ditto.
	(mark_aliases_call_clobbered): Mark entire structure clobbered if
	single SFT is clobbered.
	(set_initial_properties): Ditto.
	(compute_call_clobbered): Update for changes to function
	arguments.
	(create_overlap_variables_for): Always create SFT for offset 0.
	(create_structure_vars): Handle PHI's, since we are in SSA form at
	this point.
	* tree-ssa-loop-ivopts.c (get_ref_tag): Don't return subvars.
	* tree-ssa-operands.c (access_can_touch_variable): Don't handle
	TARGET_MEM_REF.
	(add_vars_for_offset): Figure out aliases from access + points-to.
	(add_virtual_operand): Use add_vars-for_offset.
	(get_tmr_operands): Update for NMT changes, rewrite to be correct.
	(add_call_clobber_ops): Remove makes_clobbering_call set.
	(get_expr_operands): Always pass through the INDIRECT_REF
	reference.
	* tree-ssa-structalias.c (struct constraint_graph): Remove
	variables member.
	Add pe, pe_rep, pointer_label, loc_label, pointed_by, points_to,
	address_taken, pt_used, number_incoming.
	(FIRST_ADDR_NODE): Removed.
	(merge_graph_nodes): Remove broken code for the moment.
	(init_graph): New function.
	(build_pred_graph): Remove code to init_graph.
	Add location equivalence support.
	(struct scc_info): Rename roots to deleted.
	(scc_visit): Ditto.
	(init_scc_info): Ditto
	(init_topo_info): Use graph->size.
	(compute_topo_order): Ditto.
	(do_da_constraint): Removed.
	(do_sd_constraint): Remove calls to find().
	set_union_with_increment should always get 0 as last arg here.
	(do_complex_constraint): Replace do_da_constraint with assert.
	Stop calling find.
	(struct equiv_class_label): New.
	(pointer_equiv_class_table): Ditto.
	(location_equiv_class_table): Ditto.
	(equiv_class_label_hash): Ditto.
	(equiv_class_label_eq): Ditto
	(equiv_class_lookup): Ditto.
	(equiv_class_ladd): Ditto.
	(pointer_equiv_class): Ditto.
	(location_equiv_class): Ditto.
	(condense_visit): Rename and rewrite from label_visit to do only
	SCC related stuff for HU.
	(label_visit): Do HU work for HU.
	(perform_var_substitution): Update to do HU and location
	equivalence.
	(free_var_substitution_info): Update to free HU and location
	equivalence structures.  */
	(find_equivalent_node): Update for pointer but not location
	equivalence.
	(unite_pointer_equivalences): New function.
	(move_complex_constraints): Rewrite to only do moving.
	(rewrite_constraints): Split out of move_complex_constraints.
	(solve_graph): Use graph->size.
	(process_constraint_1): Add from_call argument, use it.
	Split *a = &b into two constraints.
	(process_constraint): Use new process_constraint_1.
	(get_constraint_for_component_ref): Handle bitmaxsize == -1 case.
	(get_constraint_for): Handle non-pointer integers properly.
	Remove code that used to handle structures.
	(handle_ptr_arith): Fix a few bugs in pointer arithmetic handling
	with unknown addends.
	(handle_rhs_call): New function.
	(find_func_aliases): Use handle_rhs_call.
	(set_uids_in_ptset): Add an assert.
	(set_used_smts): Fix bug in not considering unified vars.
	(compute_tbaa_pruning): Stop initing useless iteration_obstack.
	(compute_points_to_sets): Update for other function changes.
	(delete_points_to_sets): Ditto.
	(ipa_pta_execute): Ditto.
	(pass_ipa_pta): We need to update SSA after ipa_pta.
	


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-flow.h
    trunk/gcc/tree-ssa-alias.c
    trunk/gcc/tree-ssa-loop-ivopts.c
    trunk/gcc/tree-ssa-operands.c
    trunk/gcc/tree-ssa-structalias.c

Comment 9 Daniel Berlin 2007-08-20 01:54:35 UTC
All should be fixed
Comment 10 Richard Biener 2007-08-23 12:43:43 UTC
The testcase is not fixed and you didn't add a testcase.
Comment 11 Daniel Berlin 2007-08-23 13:45:51 UTC
It did not fail for me at the point i committed the patch.
Comment 12 Jakub Jelinek 2007-09-04 06:48:18 UTC
Which testcase is not fixed?

./xgcc -B ./ -Wall -Wundef -m32 -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Werror-implicit-function-declaration -Os -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=athlon -ffreestanding -maccumulate-outgoing-args -fno-omit-frame-pointer -fno-optimize-sibling-calls -fasynchronous-unwind-tables  -fno-stack-protector pr32772-1.i -S
In file included from include/asm/thread_info.h:17,
                 from include/linux/thread_info.h:22,
                 from include/linux/preempt.h:10,
                 from include/linux/spinlock.h:50,
                 from include/linux/mmzone.h:8,
                 from include/linux/gfp.h:5,
                 from include/linux/mm.h:9,
                 from mm/page_alloc.c:19:
include/asm/processor.h: In function `cpuid_count':
include/asm/processor.h:622: warning: pointer targets in passing argument 1 of `__cpuid' differ in signedness
include/asm/processor.h:622: warning: pointer targets in passing argument 2 of `__cpuid' differ in signedness
include/asm/processor.h:622: warning: pointer targets in passing argument 3 of `__cpuid' differ in signedness
include/asm/processor.h:622: warning: pointer targets in passing argument 4 of `__cpuid' differ in signedness

succeeds on the http://gcc.gnu.org/bugzilla/attachment.cgi?id=13918&action=view
testcase, and the http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32772#c6 testcase as well.
Comment 13 Jakub Jelinek 2007-09-04 08:22:41 UTC
The testcases got fixed already by the
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127491
commit, which is why Daniel wrote
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32772#c11
Guess checking in the testcase is desirable anyway.
Comment 14 Andrew Pinski 2007-09-07 00:17:01 UTC
Fixed.
Comment 15 Jakub Jelinek 2007-09-23 09:44:40 UTC
Subject: Bug 32772

Author: jakub
Date: Sun Sep 23 09:44:23 2007
New Revision: 128688

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128688
Log:
	PR tree-optimization/32772
	* gcc.c-torture/compile/20070905-1.c: New test.

	PR tree-optimization/32975
	* gcc.dg/pr32975.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20070905-1.c
    trunk/gcc/testsuite/gcc.dg/pr32975.c
Modified:
    trunk/gcc/testsuite/ChangeLog