Empty loops have no body which means this is a NULL_TREE during const
evaluation which needs a check. Fixes Rust-GCC #3618.
gcc/rust/ChangeLog:
* backend/rust-constexpr.cc (eval_constant_expression): Check if t is a NULL_TREE
gcc/testsuite/ChangeLog:
* rust/compile/issue-3618.rs: Test empty loops error properly.
Signed-off-by: Tom Schollenberger <tss2344@g.rit.edu>
location_t loc = EXPR_LOCATION (t);
+ if (t == NULL_TREE)
+ return NULL_TREE;
+
if (CONSTANT_CLASS_P (t))
{
if (TREE_OVERFLOW (t))
--- /dev/null
+static _X: () = loop {}; // { dg-error "loop iteration count exceeds limit" }