LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1027 - llvm-g++ crash compiling MySQL 5.2.27
Summary: llvm-g++ crash compiling MySQL 5.2.27
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-g++ (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Chris Lattner
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2006-11-30 21:54 PST by Ted Kremenek
Modified: 2010-02-22 12:55 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
preprocessed .i file exhibiting the bug (795.61 KB, text/plain)
2006-11-30 21:55 PST, Ted Kremenek
Details
header file declaring template that triggers error (12.97 KB, text/plain)
2006-11-30 22:25 PST, Ted Kremenek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ted Kremenek 2006-11-30 21:54:40 PST
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
Comment 1 Ted Kremenek 2006-11-30 21:55:28 PST
Created attachment 490 [details]
preprocessed .i file exhibiting the bug
Comment 2 Reid Spencer 2006-11-30 22:16:50 PST
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?
Comment 3 Reid Spencer 2006-11-30 22:22:12 PST
The MySQL source line complained about is:

template class List<set_var_base>;

Looks pretty much like a bug to me.

Reid.
Comment 4 Ted Kremenek 2006-11-30 22:25:18 PST
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).
Comment 5 Chris Lattner 2006-12-01 00:19:45 PST
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;

Comment 6 Chris Lattner 2006-12-01 00:38:14 PST
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