Bug 285195 - devel/llvm1[5-8]: FLANG -Wmissing-template-arg-list-after-template-kw ConvertSigned(result.value) SCALE(y)
Summary: devel/llvm1[5-8]: FLANG -Wmissing-template-arg-list-after-template-kw Convert...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-06 13:08 UTC by Chad Jacob Milios
Modified: 2025-03-18 01:25 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments
git -C /usr/ports diff (590 bytes, patch)
2025-03-06 20:50 UTC, Chad Jacob Milios
milios: maintainer-approval? (brooks)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chad Jacob Milios 2025-03-06 13:08:17 UTC
fyi i had to disable FLANG in order to avoid this error compiling with 13.5-RC1/amd64. its out of my depth. my dependency was misc/py-pytorch@py311 and i'm not sure if it is concerned with FLANG support


FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o 
/usr/bin/c++ -DFLANG_LITTLE_ENDIAN=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/ports/devel/llvm15/work-default/.build/tools/flang/lib/Evaluate -I/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate -I/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/include -I/usr/ports/devel/llvm15/work-default/.build/tools/flang/include -I/usr/ports/devel/llvm15/work-default/.build/include -I/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/llvm/include -isystem /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/llvm/../mlir/include -isystem /usr/ports/devel/llvm15/work-default/.build/tools/mlir/include -isystem /usr/ports/devel/llvm15/work-default/.build/tools/clang/include -isystem /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/llvm/../clang/include -O2 -pipe -march=opteron-sse3 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O2 -pipe -march=opteron-sse3 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -DNDEBUG -std=c++17  -fno-exceptions -MD -MT tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o -MF tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o.d -o tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o -c /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/fold-real.cpp
In file included from /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/fold-real.cpp:9:
In file included from /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/fold-implementation.h:12:
In file included from /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/character.h:12:
In file included from /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/include/flang/Evaluate/type.h:20:
In file included from /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/include/flang/Evaluate/complex.h:13:
In file included from /usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/include/flang/Evaluate/real.h:13:
/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/include/flang/Evaluate/integer.h:310:32: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  310 |       auto back{FROM::template ConvertSigned(result.value)};
      |                                ^
/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/fold-real.cpp:106:22: warning: variable 'z' set but not used [-Wunused-but-set-variable]
  106 |     } else if (auto *z{UnwrapExpr<Expr<SomeComplex>>(args[0])}) {
      |                      ^
/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/fold-real.cpp:103:15: warning: variable 'x' set but not used [-Wunused-but-set-variable]
  103 |     if (auto *x{UnwrapExpr<Expr<SomeReal>>(args[0])}) {
      |               ^
/usr/ports/devel/llvm15/work-default/llvm-project-15.0.7.src/flang/lib/Evaluate/fold-real.cpp:247:60: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  247 |                                                            SCALE(y)};
      |                                                            ^
2 warnings and 2 errors generated.
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/llvm15
Comment 1 commit-hook freebsd_committer freebsd_triage 2025-03-06 19:05:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ce2f720d96cde31a9d6c3801a1b3dc583e1d23e3

commit ce2f720d96cde31a9d6c3801a1b3dc583e1d23e3
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-01-10 00:35:34 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-06 19:04:56 +0000

    devel/llvm15: backport flang fixes for llvm19

    The FLANG option is off by default so this wasn't noted in the llvm19
    import.  Backport 7bc7672925f81 from upstream LLVM.

    The patches to fold-real.cpp and reduction-templates.h were hand
    applied.

    PR:             285195
    Reported by:    milios@ccsys.com

 .../files/patch-backport-7bc7672925f81 (new)       | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)
Comment 2 Chad Jacob Milios 2025-03-06 19:37:39 UTC
(In reply to commit-hook from comment #1)

that commit indeed fixed the error in integer.h (ConvertSigned) but not the one in fold-real.cpp (SCALE, line 247-ish)
Comment 3 Chad Jacob Milios 2025-03-06 20:36:11 UTC
whoops i didnt mean to close this PR

the patch file is missing its @@ -245,7 +245,7 @@ line for flang/lib/Evaluate/fold-real.cpp

im building again now with fold-real.cpp modified as indicated
Comment 4 Chad Jacob Milios 2025-03-06 20:50:06 UTC
Created attachment 258364 [details]
git -C /usr/ports diff

this atop your latest tree commit did the trick for me

i `grep -n` the change and added the @@ line myself omitting the annotation so if the resulting hash actually matters to the port system beyond just picking up the filename then you'll want to re-source this resource lol but for me the build/package worked with this here patch to the patch lol
Comment 5 Chad Jacob Milios 2025-03-07 03:24:43 UTC
this is applicable to llvm 15-18. the patch can be copied from 15 to 16 and 17

sorry im out of my depth; i attempted a backport to llvm18 and got nowhere i wasnt afraid to go

with 18 additional fixes are needed in at least:

/usr/ports/devel/llvm18/work-default/llvm-project-18.1.8.src/flang/lib/Evaluate/fold-logical.cpp: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  258 |                         Scalar::template FromInteger(elt).flags.test(
      |                                          ^
  275 |                         Scalar::template Convert(elt).flags.test(
      |                                          ^
  294 |                         Scalar::template ConvertSigned(elt).overflow);
      |                                          ^
3 errors generated.
Comment 6 Brooks Davis freebsd_committer freebsd_triage 2025-03-12 17:01:15 UTC
Currently working my way through the patches now that I have a 13.5 jail set up the triggers the failures.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-03-14 00:57:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=78af7a3a03a4a5012cf378fd8d4c08eedf99eb05

commit 78af7a3a03a4a5012cf378fd8d4c08eedf99eb05
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-03-12 16:58:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-14 00:56:38 +0000

    devel/llvm16: fix backport of llvm19 fixes

    There was a missing line in the patch causing part of it to be ignored.

    PR:             285195
    Submitted by:   milios@ccsys.com
    Fixes:          9592edb43243 devel/llvm16: backport flang fixes for llvm19

 devel/llvm16/files/patch-backport-7bc7672925f81 | 1 +
 1 file changed, 1 insertion(+)
Comment 8 commit-hook freebsd_committer freebsd_triage 2025-03-14 00:58:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=092b9a234522e403db69de50bb04c34b6f12c709

commit 092b9a234522e403db69de50bb04c34b6f12c709
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-03-12 16:58:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-14 00:56:39 +0000

    devel/llvm18: backport llvm19 fixes

    Pull in the patch from llvm1[567] and manually patch fold-logical.cpp
    (there's nothing sensible to back port because the offending code was
    rewritten in a commit that doesn't apply easily between 18 and 19.)

    PR:             283966, 285195
    Submitted by:   milios@ccsys.com (fixed backport patch)

 .../files/patch-backport-7bc7672925f81 (new)       | 76 ++++++++++++++++++++++
 ...patch-flang_lib_Evaluate_fold-logical.cpp (new) | 29 +++++++++
 2 files changed, 105 insertions(+)
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-03-14 00:58:05 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=50eaa5a64eb72b760ae74c8254c3f23a9c534063

commit 50eaa5a64eb72b760ae74c8254c3f23a9c534063
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-03-12 16:58:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-14 00:56:37 +0000

    devel/llvm15: fix backport of llvm19 fixes

    There was a missing line in the patch causing part of it to be ignored.

    PR:             285195
    Submitted by:   milios@ccsys.com
    Fixes:          ce2f720d96cd devel/llvm15: backport flang fixes for llvm19

 devel/llvm15/files/patch-backport-7bc7672925f81 | 1 +
 1 file changed, 1 insertion(+)
Comment 10 commit-hook freebsd_committer freebsd_triage 2025-03-14 00:58:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=62739e5a874c4114b4e049dbbd655e7f88c017a3

commit 62739e5a874c4114b4e049dbbd655e7f88c017a3
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-01-10 00:35:34 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-14 00:56:38 +0000

    devel/llvm17: backport flang fixes for llvm19

    The FLANG option is off by default so this wasn't noted in the llvm19
    import.  Backport 7bc7672925f81 from upstream LLVM.

    The patches to fold-real.cpp and reduction-templates.h were hand
    applied.

    PR:             283966, 285195
    Reported by:    ohartmann@walstatt.org
    Submitted by:   milios@ccsys.com

 .../files/patch-backport-7bc7672925f81 (new)       | 76 ++++++++++++++++++++++
 1 file changed, 76 insertions(+)
Comment 11 Brooks Davis freebsd_committer freebsd_triage 2025-03-14 00:59:58 UTC
I think I've fixed all the ports with FLANG enabled.  I plan to let these soak over the weekend and then do some merges to the quarterly branch.
Comment 12 Chad Jacob Milios 2025-03-14 23:18:41 UTC
(In reply to Brooks Davis from comment #11)

all four llvm1[5-8] now rebuilt, packaged and installed with FLANG support. so i'd say this PR looks good and solved.

of them, however, i could only successfully compile+run a test program using flang18 and flang-new18 (and flang14, flang-new19 and flang20 as well for that matter, fyi). if this is of anyone's concern, we can address those in a new PR. (Note: i don't use Fortran regularly; i am NOT indicating that every variant has ever worked before.)

some background i learned: the "classic" (in the context of llvm) fortran frontend was open sourced by The Portland Group, Inc. in 2015. it targeted llvm intermediate representation (perhaps among other options). that is whats been included as "flang" prior to llvm19. flang-new is a newer frontend developed by the LLVM project beginning roundabouts 2020. in [our(?)] llvm19 [the port], only flang-new is included anymore (while understandably neither gets included with our base llvm in /usr/bin). in llvm20, flang-new was renamed to plain old flang (aka flang20, for our package)

i think youre safe to close this PR (FIXED) now. thank you for the quick resolution
Comment 13 Brooks Davis freebsd_committer freebsd_triage 2025-03-14 23:37:25 UTC
IIRC the old frontend isn't really a proper compiler driver in that it doesn't do basic things like link in the runtime library.  I've made it possible to build to support exploration, but there's an argument I should be aggressively disabling it in older versions.

I'll accept reports with patches for things that can be fixed, but for things that aren't configuration tweaks I'll encourage use of llvm20 or llvm-devel where we're likely to get upstream's attention with issues.
Comment 14 commit-hook freebsd_committer freebsd_triage 2025-03-17 18:39:00 UTC
A commit in branch 2025Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ade92d9844b29bbc1ac41b61150a887a84e6a7b3

commit ade92d9844b29bbc1ac41b61150a887a84e6a7b3
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-03-12 16:58:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-17 18:38:09 +0000

    devel/llvm16: fix backport of llvm19 fixes

    There was a missing line in the patch causing part of it to be ignored.

    PR:             285195
    Submitted by:   milios@ccsys.com
    Fixes:          9592edb43243 devel/llvm16: backport flang fixes for llvm19

    (cherry picked from commit 78af7a3a03a4a5012cf378fd8d4c08eedf99eb05)

 devel/llvm16/files/patch-backport-7bc7672925f81 | 1 +
 1 file changed, 1 insertion(+)
Comment 15 commit-hook freebsd_committer freebsd_triage 2025-03-17 18:39:11 UTC
A commit in branch 2025Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8c9c675ac883eb714c97f4b25491988e845cb47f

commit 8c9c675ac883eb714c97f4b25491988e845cb47f
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-01-10 00:35:34 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-17 18:38:09 +0000

    devel/llvm17: backport flang fixes for llvm19

    The FLANG option is off by default so this wasn't noted in the llvm19
    import.  Backport 7bc7672925f81 from upstream LLVM.

    The patches to fold-real.cpp and reduction-templates.h were hand
    applied.

    PR:             283966, 285195
    Reported by:    ohartmann@walstatt.org
    Submitted by:   milios@ccsys.com

    (cherry picked from commit 62739e5a874c4114b4e049dbbd655e7f88c017a3)

 .../files/patch-backport-7bc7672925f81 (new)       | 76 ++++++++++++++++++++++
 1 file changed, 76 insertions(+)
Comment 16 commit-hook freebsd_committer freebsd_triage 2025-03-17 18:39:20 UTC
A commit in branch 2025Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=670a29d46198724fda3f1159dd1ddf631bf40071

commit 670a29d46198724fda3f1159dd1ddf631bf40071
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-03-12 16:58:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-17 18:38:08 +0000

    devel/llvm15: fix backport of llvm19 fixes

    There was a missing line in the patch causing part of it to be ignored.

    PR:             285195
    Submitted by:   milios@ccsys.com
    Fixes:          ce2f720d96cd devel/llvm15: backport flang fixes for llvm19

    (cherry picked from commit 50eaa5a64eb72b760ae74c8254c3f23a9c534063)

 devel/llvm15/files/patch-backport-7bc7672925f81 | 1 +
 1 file changed, 1 insertion(+)
Comment 17 commit-hook freebsd_committer freebsd_triage 2025-03-17 18:39:25 UTC
A commit in branch 2025Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=48d88a1daa6bffcfe8cf571e69c844d3787c4d4c

commit 48d88a1daa6bffcfe8cf571e69c844d3787c4d4c
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-03-12 16:58:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-17 18:38:09 +0000

    devel/llvm18: backport llvm19 fixes

    Pull in the patch from llvm1[567] and manually patch fold-logical.cpp
    (there's nothing sensible to back port because the offending code was
    rewritten in a commit that doesn't apply easily between 18 and 19.)

    PR:             283966, 285195
    Submitted by:   milios@ccsys.com (fixed backport patch)

    (cherry picked from commit 092b9a234522e403db69de50bb04c34b6f12c709)

 .../files/patch-backport-7bc7672925f81 (new)       | 76 ++++++++++++++++++++++
 ...patch-flang_lib_Evaluate_fold-logical.cpp (new) | 29 +++++++++
 2 files changed, 105 insertions(+)
Comment 18 commit-hook freebsd_committer freebsd_triage 2025-03-17 18:39:37 UTC
A commit in branch 2025Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=86029af6c255b55c790297c0b84da3193b4bba64

commit 86029af6c255b55c790297c0b84da3193b4bba64
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-01-10 00:35:34 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-03-17 18:38:08 +0000

    devel/llvm15: backport flang fixes for llvm19

    The FLANG option is off by default so this wasn't noted in the llvm19
    import.  Backport 7bc7672925f81 from upstream LLVM.

    The patches to fold-real.cpp and reduction-templates.h were hand
    applied.

    PR:             285195
    Reported by:    milios@ccsys.com

    (cherry picked from commit ce2f720d96cde31a9d6c3801a1b3dc583e1d23e3)

 .../files/patch-backport-7bc7672925f81 (new)       | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)