From 475d72f8e631b4dcee450d2983dbcf03bc105bce Mon Sep 17 00:00:00 2001 From: peter klausler Date: Fri, 15 Feb 2019 14:26:23 -0800 Subject: [PATCH] [flang] push for review Original-commit: flang-compiler/f18@17dc73591104ee0c171b1d66ef24703ff612d909 Reviewed-on: https://github.com/flang-compiler/f18/pull/287 Tree-same-pre-rewrite: false --- flang/lib/common/idioms.h | 2 +- flang/lib/parser/parse-tree.h | 1 - flang/lib/parser/parsing.h | 2 +- flang/lib/semantics/expression.cc | 22 +++++++++++++++------- flang/test/semantics/CMakeLists.txt | 10 +--------- flang/test/semantics/resolve43.f90 | 11 ----------- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/flang/lib/common/idioms.h b/flang/lib/common/idioms.h index 127df70..524c94f 100644 --- a/flang/lib/common/idioms.h +++ b/flang/lib/common/idioms.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/flang/lib/parser/parse-tree.h b/flang/lib/parser/parse-tree.h index 21a1f47..c04ac34 100644 --- a/flang/lib/parser/parse-tree.h +++ b/flang/lib/parser/parse-tree.h @@ -1142,7 +1142,6 @@ WRAPPER_CLASS(ComponentDataSource, common::Indirection); // R757 component-spec -> [keyword =] component-data-source struct ComponentSpec { TUPLE_CLASS_BOILERPLATE(ComponentSpec); - mutable const semantics::Symbol *symbol{nullptr}; // completed by semantics std::tuple, ComponentDataSource> t; }; diff --git a/flang/lib/parser/parsing.h b/flang/lib/parser/parsing.h index 819bf18..a252096 100644 --- a/flang/lib/parser/parsing.h +++ b/flang/lib/parser/parsing.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/flang/lib/semantics/expression.cc b/flang/lib/semantics/expression.cc index 0422832..a51c6cd 100644 --- a/flang/lib/semantics/expression.cc +++ b/flang/lib/semantics/expression.cc @@ -609,7 +609,8 @@ static MaybeExpr AnalyzeExpr( auto kind{AnalyzeKindParam(context, x.kind, defaultKind)}; if (letterKind.has_value() && kind != *letterKind) { context.Say( - "explicit kind parameter on real constant disagrees with exponent letter"_en_US); + "explicit kind parameter on real constant disagrees with " + "exponent letter"_en_US); } auto result{common::SearchTypes( RealTypeVisitor{kind, x.real.source, context.GetFoldingContext()})}; @@ -1040,7 +1041,8 @@ static MaybeExpr AnalyzeExpr( context.Say(name, "type parameter is not INTEGER"_err_en_US); } else { context.Say(name, - "type parameter inquiry must be applied to a designator"_err_en_US); + "type parameter inquiry must be applied to " + "a designator"_err_en_US); } } else if (dtSpec == nullptr || dtSpec->scope() == nullptr) { context.Say(name, @@ -1182,10 +1184,13 @@ void ArrayConstructorContext::Push(MaybeExpr &&x) { if (exprContext_.context().warnOnNonstandardUsage() && *thisLen != *constantLength_) { exprContext_.Say( - "Character literal in array constructor without explicit type has different length than earlier element"_en_US); + "Character literal in array constructor without explicit " + "type has different length than earlier element"_en_US); } if (*thisLen > *constantLength_) { - // Language extension (TODO pmk document) + // Language extension: use the longest literal to determine the + // length of the array constructor's character elements, not the + // first, when there is no explicit type. *constantLength_ = *thisLen; type_->length = std::move(xType.length); } @@ -1196,14 +1201,16 @@ void ArrayConstructorContext::Push(MaybeExpr &&x) { } } else { exprContext_.Say( - "Values in array constructor must have the same declared type when no explicit type appears"_err_en_US); + "Values in array constructor must have the same declared type " + "when no explicit type appears"_err_en_US); } } else { if (auto cast{ConvertToType(*type_, std::move(*x))}) { values_.Push(std::move(*cast)); } else { exprContext_.Say( - "Value in array constructor could not be converted to the type of the array"_err_en_US); + "Value in array constructor could not be converted to the type " + "of the array"_err_en_US); } } } @@ -1261,7 +1268,8 @@ void ArrayConstructorContext::Add(const parser::AcValue &x) { bool inserted{exprContext_.AddAcImpliedDo(name, kind)}; if (!inserted) { exprContext_.SayAt(name, - "Implied DO index is active in surrounding implied DO loop and cannot have the same name"_err_en_US); + "Implied DO index is active in surrounding implied DO loop " + "and cannot have the same name"_err_en_US); } std::optional> lower{ GetSpecificIntExpr(exprContext_, bounds.lower)}; diff --git a/flang/test/semantics/CMakeLists.txt b/flang/test/semantics/CMakeLists.txt index c7e404c..c275160 100644 --- a/flang/test/semantics/CMakeLists.txt +++ b/flang/test/semantics/CMakeLists.txt @@ -115,15 +115,7 @@ set(MODFILE_TESTS ) set(LABEL_TESTS -# label*.[Ff]90 # 01, 05, 06, 07 loop with current master - label02.f90 - label03.f90 - label04.f90 - label08.f90 - label09.f90 - label10.f90 - label11.f90 - label12.f90 + label*.[Ff]90 ) set(DOCONCURRENT_TESTS diff --git a/flang/test/semantics/resolve43.f90 b/flang/test/semantics/resolve43.f90 index 6ce7087..68439cb 100644 --- a/flang/test/semantics/resolve43.f90 +++ b/flang/test/semantics/resolve43.f90 @@ -27,10 +27,6 @@ module module1 integer, kind :: k integer :: m end type type2 - type, abstract :: abstract(j) - integer, kind :: j - integer :: n - end type abstract type :: privaten(j) integer, kind :: j integer, private :: n @@ -42,22 +38,15 @@ module module1 subroutine type2arg(x) type(type2(0,0)), intent(in) :: x end subroutine type2arg - subroutine abstractarg(x) - type(abstract(0)), intent(in) :: x - end subroutine abstractarg subroutine errors call type1arg(type1(0)()) call type1arg(type1(0)(1)) call type1arg(type1(0)(n=1)) !ERROR: Keyword 'bad' is not a component of this derived type call type1arg(type1(0)(bad=1)) - !ERROR: Unexpected value in structure constructor - call type1arg(type1(0)(1,2)) call type2arg(type2(0,0)(n=1,m=2)) call type2arg(type2(0,0)(m=2)) call type2arg(type2(0,0)(type1=type1(0)(n=1),m=2)) call type2arg(type2(0,0)(type1=type1(0)(),m=2)) - !ERROR: ABSTRACT type cannot be used in a structure constructor - call abstractarg(abstract(0)(n=1)) end subroutine errors end module module1 -- 2.7.4