[PATCH] D89500: Fix the error message with -fbasic-block-sections=list=<filename>

Sriraman Tallam via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 12:00:39 PDT 2020


On Wed, Oct 21, 2020 at 11:59 AM Sriraman Tallam <tmsriram at google.com> wrote:
>
> On Wed, Oct 21, 2020 at 11:45 AM Sriraman Tallam <tmsriram at google.com> wrote:
> >
> > On Wed, Oct 21, 2020 at 11:07 AM David Blaikie via Phabricator
> > <reviews at reviews.llvm.org> wrote:
> > >
> > > dblaikie added a comment.
> > >
> > > In D89500#2344234 <https://reviews.llvm.org/D89500#2344234>, @davezarzycki wrote:
> > >
> > > > I think I fixed it. Please verify: 87f6de72bcd346bbbf468e9f9a0e9d1bbf0630a9 <https://reviews.llvm.org/rG87f6de72bcd346bbbf468e9f9a0e9d1bbf0630a9>
> > >
> > > Thanks - if that's unblocked you, great!
> > >
> > > @tmsriram could you check on this? I'm surprised this test isn't failing - I can't see any CHECK lines for the "ERROR" prefix used by the error test (& FileCheck usually fails if it finds no relevant CHECK lines... so I'm not sure what's happening there).
> >
> > @dblaikie https://github.com/llvm/llvm-project/blob/master/clang/test/CodeGen/basic-block-sections.c#L42
> >
> >
> > >
> > > Also: I'd expect a failing compilation not to write the file out? (I'd expect it to be writing to a temporary file, then moving the file into position once the compilation has finished successfully, so there's never a half-written file, etc - in case the compiler crashes) so I wonder what's going on here. Could you check what the behavior is/why it's trying to write a file even when there's an error? (I could be wrong on my assumptions/understanding here - perhaps this is true of other error paths too, that they do try to write the output file and maybe delete it after instead (though that wouldn't be crash-resilient))
>
> So, this change:
>
> diff --git a/clang/test/CodeGen/basic-block-sections.c
> b/clang/test/CodeGen/basic-block-sections.c
> index 2eefbbfd21e..95ab2e54cb2 100644
> --- a/clang/test/CodeGen/basic-block-sections.c
> +++ b/clang/test/CodeGen/basic-block-sections.c
> @@ -6,7 +6,7 @@
>  // RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=all -o -
> < %s | FileCheck %s --check-prefix=BB_WORLD --check-prefix=BB_ALL
>  // RUN: %clang_cc1 -triple x86_64 -S
> -fbasic-block-sections=list=%S/Inputs/basic-block-sections.funcnames
> -o - < %s | FileCheck %s --check-prefix=BB_WORLD
> --check-prefix=BB_LIST
>  // RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=all
> -funique-basic-block-section-names -o - < %s | FileCheck %s
> --check-prefix=UNIQUE
> -// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj -o - %s
> 2>&1 | FileCheck %s --check-prefix=ERROR
> +// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj -o
> /dev/null %s 2>&1 | FileCheck %s --check-prefix=ERROR
>
>  specifically redirecting the file to /dev/null seems like it would
> solve the problem.  WDYT?

Sorry the diff got clobbered.  Basically replacing "-o -" with "-o /dev/null".

>
> Thanks
> Sri
>
>
> > >
> > >
> > > Repository:
> > >   rG LLVM Github Monorepo
> > >
> > > CHANGES SINCE LAST ACTION
> > >   https://reviews.llvm.org/D89500/new/
> > >
> > > https://reviews.llvm.org/D89500
> > >


More information about the cfe-commits mailing list