[Bug c++/91493] New: g++ 9.2.1 crashes compiling clickhouse

2019-08-19 Thread rafaeldtinoco at ubuntu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91493

Bug ID: 91493
   Summary: g++ 9.2.1 crashes compiling clickhouse
   Product: gcc
   Version: 9.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rafaeldtinoco at ubuntu dot com
  Target Milestone: ---

The following function:

std::string toString(const ColumnDefaultKind kind)
{
static const std::unordered_map map{
{ ColumnDefaultKind::Default, AliasNames::DEFAULT },
{ ColumnDefaultKind::Materialized, AliasNames::MATERIALIZED },
{ ColumnDefaultKind::Alias, AliasNames::ALIAS }
};

const auto it = map.find(kind);
return it != std::end(map) ? it->second : throw Exception{"Invalid
ColumnDefaultKind", ErrorCodes::LOGICAL_ERROR};
}

causes gcc9 (with attached dump) to crash while other similar function (in
related syntax):

ColumnDefaultKind columnDefaultKindFromString(const std::string & str)
{
static const std::unordered_map map{
{ AliasNames::DEFAULT, ColumnDefaultKind::Default },
{ AliasNames::MATERIALIZED, ColumnDefaultKind::Materialized },
{ AliasNames::ALIAS, ColumnDefaultKind::Alias }
};

const auto it = map.find(str);
return it != std::end(map) ? it->second : throw Exception{"Unknown column
default specifier: " + str, ErrorCodes::LOGICAL_ERROR};
}

does not. Changing the syntax to:

std::string toString(const ColumnDefaultKind kind)
{
static const std::unordered_map map{
{ ColumnDefaultKind::Default, AliasNames::DEFAULT },
{ ColumnDefaultKind::Materialized, AliasNames::MATERIALIZED },
{ ColumnDefaultKind::Alias, AliasNames::ALIAS }
};

const auto it = map.find(kind);

if (it != std::end(map))
throw Exception{"Invalid ColumnDefaultKind",
ErrorCodes::LOGICAL_ERROR};

return it->second;
}

fixes the issue.

[Bug c++/91500] [9 Regression] gcc-9 ICE on valid code

2019-08-20 Thread rafaeldtinoco at ubuntu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91500

Rafael David Tinoco  changed:

   What|Removed |Added

 CC||rafaeldtinoco at ubuntu dot com

--- Comment #3 from Rafael David Tinoco  ---
Related:

https://github.com/yandex/ClickHouse/issues/6560
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91493

[Bug c++/91493] g++ 9.2.1 crashes compiling clickhouse

2019-08-20 Thread rafaeldtinoco at ubuntu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91493

--- Comment #2 from Rafael David Tinoco  ---
Related:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91500

Possibly a duplicate.