compiling set_var.cc in MySQL 5.2.27 triggers an internal compilation error: make[4]: Nothing to be done for `all'. if llvm-g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local\"" -DDATADIR="\"/usr/local/var\"" -DSHAREDIR="\"/usr/local/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../innobase/include -I../include -I../include -I../regex -I. -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -MT set_var.o -MD -MP -MF ".deps/set_var.Tpo" -c -o set_var.o set_var.cc; \ then mv -f ".deps/set_var.Tpo" ".deps/set_var.Po"; else rm -f ".deps/set_var.Tpo"; exit 1; fi set_var.cc:3690: internal compiler error: in EmitLV_COMPONENT_REF, at llvm-convert.cpp:4841 Please submit a full bug report, Attached is the preprocessed .i file. compile with: llvm-g++ -fno-implicit-templates -fno-exceptions -fno-rtti -c -o set_var.o set_var.i
Created attachment 490 [details] preprocessed .i file exhibiting the bug
The code in question is: // Check for variable sized array reference. if (TREE_CODE(TREE_TYPE(Array)) == ARRAY_TYPE) { tree Domain = TYPE_DOMAIN(TREE_TYPE(Array)); if (Domain && TYPE_MAX_VALUE(Domain)) { assert(TREE_CODE(TYPE_MAX_VALUE(Domain)) == INTEGER_CST && "Cannot have globals with variable size!"); } } Does MySQL try to create a variable sized global array on that line?
The MySQL source line complained about is: template class List<set_var_base>; Looks pretty much like a bug to me. Reid.
Created attachment 491 [details] header file declaring template that triggers error from set_var.cc: /**************************************************************************** Used templates ****************************************************************************/ #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List<set_var_base>; template class List_iterator_fast<set_var_base>; <--- LINE 3690 template class I_List_iterator<NAMED_LIST>; #endif List_iterator_fast is declared in "sql_list.h" (attached).
Reduced testcase: struct sys_var { unsigned name_length; bool no_support_one_shot; sys_var() {} }; struct sys_var_thd : public sys_var { }; extern sys_var_thd sys_auto_is_null; sys_var *sys_variables = &sys_auto_is_null;
Fixed, testcase here: Regression/C++Frontend/2006-11-30-ConstantExprCrash.cpp Patch here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061127/040515.html Thanks Ted! -Chris