[flang-commits] [clang] [flang] [Flang] Adding -ffree-line-length-<value> flag (PR #192941)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Fri May 1 11:37:20 PDT 2026


akuhlens wrote:

I know this post is longer than most, I am just trying to be really explicit since I think my original intent was confused.

> > > The maximum line width that conflicts with earlier standard is symptomatic of a bigger issue in flang. I don't think this ought to be blocked while that gets resolved. I'm ok with choosing either 10K - the value from F2023 - or sticking with the larger value that we had earlier.
> > >
> > Could you clarify what the bigger issue in flang is?
> >
> As I understand it, the `-std=` flag doesn't have any obvious effect. When there are inconsistencies between standards, there is no way for a user to force strict compliance with a specific standard. ...

I agree that there is a bigger issue with Flang, that there isn't currently a way to configure checking for different standards. Another large issue might be that we (as a community) haven't explicitly stated what we would like the default behavior of the compiler given no standard flag, but I would claim that `llvm-project/flang/Docs/extensions.md` implies that the compiler by default should be as lenient and maximally compatible as possible as long as it doesn't get in the way of compiling correctly a standards complying program. 

My previous statement that I think kicked off this confusion was:
> I doubt it is needed, but prior to this there was no limit to the line length in free form. This PR imposes the F2023 standard on all programs. It would be nice to bake in a sentinel value that is the default and only enable this when F2023 is used or the command line option explicitly enables it.

This statement was misleading and I apologize for the miscommunication and I will try to do better in the future. I think the primary source of confusion was an implementation detail that I wasn't really thinking about, but happened to mention: "when F2023 is used" by which I meant "--std=f2023" is passed at the command line. I don't really care about the standard flag working with this PR. I was not intending to ask for that. 

What I was intending to convey with this statement was: 
1. This probably isn't a problem in practice, since I know of no programs that have a 10,000 character line.
2. This PR imposes a constraint from the F2023 standard on all programs by default.
3. There is no current way to cleanly disable adding some restriction with this current implementation.
4. Please fix this.

I probably should have spent more effort explaining my position since I was asking the author for more work:
- Even if it isn't a problem in practice it is easier for a client of this code to reason about being able to just disable this check than picking some size big enough such that all programs compile in practice.
- The reduction in complexity for clients of this code is worth the complexity that I imagine it would introduce in this code.
- Based on the `extensions.md` doc and my time in the codebase Flang consistently tries to be lenient compiler by default.

Ok, again I apologize for my original miscommunication and I only intend going on at length to prevent further miscommunication.  🙏❤️

https://github.com/llvm/llvm-project/pull/192941


More information about the flang-commits mailing list