https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79227

            Bug ID: 79227
           Summary: Questionable -Wmisleading-indentation diagnostic in
                    HSAIL-Tools
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: dmalcolm at gcc dot gnu.org, ppalka at gcc dot gnu.org
  Target Milestone: ---

Created attachment 40576
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40576&action=edit
reduced "HSAILValidatorBase.cpp" file

I don't have any strong opinion, so I'm asking you to please check the
following.

Compiling <https://github.com/HSAFoundation/HSAIL-Tools>, commit
12220b0ddccd4559e979906bfd65fb49fcdd7854 with Ubuntu GCC 6.2.0-5ubuntu12, the
build aborts:

    [...]/libHSAIL/HSAILValidatorBase.cpp: In member function 'virtual bool
HSAIL_ASM::PropValidator::checkOperandKind(HSAIL_ASM::Inst, unsigned int,
unsigned int*, unsigned int, bool) const':
    [...]/libHSAIL/HSAILValidatorBase.cpp:395:37: error: this 'if' clause does
not guard... [-Werror=misleading-indentation]
             case OPERAND_VAL_FUNC:      if (isCodeRef(opr,
BRIG_KIND_DIRECTIVE_FUNCTION) ||
                                         ^~
    [...]/libHSAIL/HSAILValidatorBase.cpp:396:110: note: ...this statement, but
the latter is misleadingly indented as if it is guarded by the 'if'
                                             isCodeRef(opr,
BRIG_KIND_DIRECTIVE_INDIRECT_FUNCTION))  return true; break;
                                                                               
                                  ^~~~~
    cc1plus: all warnings being treated as errors

I'm attaching a reduced "HSAILValidatorBase.cpp" file, showing the issue for
both C and C++ compilation.

Should the code be considered well-formed enough to not warn in this case?

Reply via email to