openjdk/jdk · error

%s: Found %d syntax error

Error message

%s:  Found %d syntax error

What it means

Not a thrown error: a phase-1 parse summary that ADLC prints to stderr when _AD._syntax_errs > 0 after parsing a .ad file — '"%s: Found %d syntax error(s)."' with the input file name and count. It means the ADL grammar was violated; the generated output must not be trusted (see _AD._no_output) even though ADLC may continue to completion.

Source

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

//------------------------------~ADLParser-------------------------------------
// Delete an ADL parser.
ADLParser::~ADLParser() {
  if (!_AD._quiet_mode)
    fprintf(stderr,"---------------------------- Errors and Warnings ----------------------------\n");
#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

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Scroll up in the build log: each individual syntax error was printed earlier with file/line context
  2. Fix the reported lines (usually a missing ';', '}', or unbalanced parenthesis)
  3. Diff your .ad change against a known-good revision to spot the typo
  4. Rerun 'make adlc' or the full build to confirm zero errors
Defensive patterns

Strategy: validation

Validate before calling

# quick grammar sanity before full build: parentheses balanced per rule
awk '{o+=gsub(/\(/,"("); c+=gsub(/\)/,")")} END { if (o!=c) { print "unbalanced parens"; exit 1 } }' src/hotspot/cpu/x86/x86.ad

Prevention

When it happens

Trigger: Any ADL grammar violation in a cpu/*/*.ad file: missing ';', unbalanced parentheses in match rules, bad ident characters, stray tokens after a definition. ADLParser::parse() increments _AD._syntax_errs via parse_err/sync and this report runs at the end of phase-1 parsing.

Common situations: Hand-editing .ad files to add instructions/operands; porting .ad files between HotSpot versions where the grammar changed; merge conflicts resolved incorrectly in .ad files.

Related errors


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