Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions flang/lib/Semantics/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,11 +2076,15 @@ MaybeExpr ArrayConstructorContext::ToExpr() {

MaybeExpr ExpressionAnalyzer::Analyze(const parser::ArrayConstructor &array) {
const parser::AcSpec &acSpec{array.v};
bool hadAnyFatalError{context_.AnyFatalError()};
ArrayConstructorContext acContext{
*this, AnalyzeTypeSpec(acSpec.type, GetFoldingContext())};
for (const parser::AcValue &value : acSpec.values) {
acContext.Add(value);
}
if (!hadAnyFatalError && context_.AnyFatalError()) {
return std::nullopt;
}
return acContext.ToExpr();
}

Expand Down
8 changes: 8 additions & 0 deletions flang/test/Semantics/bug127425.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
! RUN: %python %S/test_errors.py %s %flang_fc1

program main
pointer (j1,ja)
pointer (j2,jb)
!ERROR: Values in array constructor must have the same declared type when no explicit type appears
if (any((/j1,j2,j3,j4,j5/)/=(/1,2,3,4,5/))) print *,'fail'
end program main