Re: Strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 March 2011 05:26, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
> I think you want build_fold_addr_expr(build_string(length, "foobar")).
>

Hey

I think that did the right but i am getting this error:

In function ‘foo’:
gpy1: internal compiler error: output_operand: invalid expression as operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I spent quite a while trying to trace it from when
cgraph_finalize_compilation_unit () and it comes down to:

Breakpoint 1, tree_rest_of_compilation (fndecl=0xb7ab3a80) at
../../gcc-dev/gcc/tree-optimize.c:389
389	{
(gdb) next
392	  timevar_push (TV_REST_OF_COMPILATION);
(gdb)
389	{
(gdb)
392	  timevar_push (TV_REST_OF_COMPILATION);
(gdb)
394	  gcc_assert (cgraph_global_info_ready);
(gdb)
397	  bitmap_obstack_initialize (NULL);
(gdb)
401	  saved_loc = input_location;
(gdb)
400	  current_function_decl = fndecl;
(gdb)
402	  input_location = DECL_SOURCE_LOCATION (fndecl);
(gdb)
403	  init_function_start (fndecl);
(gdb)
402	  input_location = DECL_SOURCE_LOCATION (fndecl);
(gdb)
403	  init_function_start (fndecl);
(gdb)
409	  cfun->dont_save_pending_sizes_p = 1;
(gdb)
411	  gimple_register_cfg_hooks ();
(gdb)
413	  bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL
generation*/
(gdb)
415	  execute_all_ipa_transforms ();
(gdb)
420	  invoke_plugin_callbacks (PLUGIN_ALL_PASSES_START, NULL);
(gdb)
422	  execute_pass_list (all_passes);
(gdb)
In function ‘foo’:
gpy1: internal compiler error: output_operand: invalid expression as operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Program exited with code 04.

But i am not sure where i can debug this any further.

Example of where this string code is being used is

  const char * c_ident = IDENTIFIER_POINTER(DECL_NAME(decl));

  tree str = build_string (strlen (c_ident), c_ident);
  TREE_TYPE (str) = gpy_const_char_ptr;
  tree ident = build_fold_addr_expr (str);

  return build_call_expr (gpy_rr_decl, 3,
			  build_fold_addr_expr (decl),
			  build_int_cst (integer_type_node, n),
			  ident);

Only got this error when i have this tree code being put in my blocks.

--Phil



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux