llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

llvm-g++ crash compiling MySQL 5.2.27

Open tkremenek opened this issue 20 years ago • 6 comments

Bugzilla Link 1027
Resolution FIXED
Resolved on Feb 22, 2010 12:55
Version trunk
OS All
Attachments preprocessed .i file exhibiting the bug

Extended Description

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

tkremenek avatar Dec 01 '06 05:12 tkremenek

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

lattner avatar Dec 01 '06 08:12 lattner

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;

lattner avatar Dec 01 '06 08:12 lattner

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).

tkremenek avatar Dec 01 '06 06:12 tkremenek

The MySQL source line complained about is:

template class List<set_var_base>;

Looks pretty much like a bug to me.

Reid.

llvmbot avatar Dec 01 '06 06:12 llvmbot

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?

llvmbot avatar Dec 01 '06 06:12 llvmbot

assigned to @lattner

tkremenek avatar Dec 01 '06 05:12 tkremenek