openjdk/jdk · error

%s: Found %d semantic error

Error message

%s:  Found %d semantic error

What it means

Phase-1 ADLC summary line '"%s: Found %d semantic error(s)."' printed when _AD._semantic_errs > 0. Unlike syntax errors, the .ad text parsed but violated ADL semantics: duplicate definitions, undeclared operand/instruction references, bad register class references, misuse of interface components. Output files are suppressed/invalid until errors reach zero.

Source

Thrown at src/hotspot/share/adlc/adlparse.cpp:68

#ifndef ASSERT
  if (!_AD._quiet_mode) {
    fprintf(stderr, "**************************************************************\n");
    fprintf(stderr, "***** WARNING: ASSERT is undefined, assertions disabled. *****\n");
    fprintf(stderr, "**************************************************************\n");
  }
#endif
  if( _AD._syntax_errs + _AD._semantic_errs + _AD._warnings == 0 ) {
    if (!_AD._quiet_mode)
      fprintf(stderr,"No errors or warnings to report from phase-1 parse.\n" );
  }
  else {
    if( _AD._syntax_errs ) {      // Any syntax errors?
      fprintf(stderr,"%s:  Found %d syntax error", _buf._fp->_name, _AD._syntax_errs);
      if( _AD._syntax_errs > 1 ) fprintf(stderr,"s.\n\n");
      else fprintf(stderr,".\n\n");
    }
    if( _AD._semantic_errs ) {    // Any semantic errors?
      fprintf(stderr,"%s:  Found %d semantic error", _buf._fp->_name, _AD._semantic_errs);
      if( _AD._semantic_errs > 1 ) fprintf(stderr,"s.\n\n");
      else fprintf(stderr,".\n\n");
    }
    if( _AD._warnings ) {         // Any warnings?
      fprintf(stderr,"%s:  Found %d warning", _buf._fp->_name, _AD._warnings);
      if( _AD._warnings > 1 ) fprintf(stderr,"s.\n\n");
      else fprintf(stderr,".\n\n");
    }
  }
  if (!_AD._quiet_mode)
    fprintf(stderr,"-----------------------------------------------------------------------------\n");
  _AD._TotalLines += linenum()-1;     // -1 for overshoot in "nextline" routine

  // Write out information we have stored
  // // UNIXism == fsync(stderr);
}

//------------------------------parse------------------------------------------

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Read the individual semantic error lines above the summary; each names the construct
  2. Declare any missing operands/instructions/register classes before first use
  3. Cross-check identifier spelling between operand definitions, match rules, and encode blocks
  4. Rebuild and iterate until 'No errors or warnings to report from phase-1 parse.'
Defensive patterns

Strategy: validation

Validate before calling

# ensure every operand referenced in match rules is defined
for name in $(grep -oP 'match\(\s*\(\s*\w+' -m0 src/hotspot/cpu/x86/x86.ad); do :; done # see scripts; rely on adlc itself

Prevention

When it happens

Trigger: Semantic checks in ADLParser (e.g. referencing an operand class before declaration, redefining an instruction encoding, wrong pipe description) increment _AD._semantic_errs; this message aggregates them at end of parse.

Common situations: Adding a new operand but forgetting its definition; renaming an instruction without updating all match/encode references; .ad files written against an older HotSpot ADL semantic set.

Related errors


AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14). Data as JSON: /api/errors/cdd5b363ade7c94c. Report an issue: GitHub.