openjdk/jdk · error

Error Context: %s>>>%c<<<%s

Error message

Error Context:  %s>>>%c<<<%s

What it means

ADLC's error-context printer: when a syntax error is flagged (flag == 1), ADLParser reprints the offending line as 'Error Context: <head>>>> <char> <<<tail>' — the text before the erroring character, the character itself between '>>>' and '<<<', and the rest of the line. It is a diagnostic aid that accompanies the actual error message, produced by rewriting the in-memory line buffer (temporarily NUL-terminating head and tail).

Source

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

    _AD._semantic_errs += _AD.emit_msg(0, flag, linenum(), fmt, args);
  else
    _AD._warnings += _AD.emit_msg(0, flag, linenum(), fmt, args);

  int error_char = _curchar;
  char* error_ptr = _ptr+1;
  for(;*_ptr != '\n'; _ptr++) ; // Skip to the end of the current line
  _curchar = '\n';
  va_end(args);
  _AD._no_output = 1;

  if (flag == 1) {
    char* error_tail = strchr(error_ptr, '\n');
    char tem = *error_ptr;
    error_ptr[-1] = '\0';
    char* error_head = error_ptr-1;
    while (error_head > _curline && *error_head)  --error_head;
    if (error_tail)  *error_tail = '\0';
    fprintf(stderr, "Error Context:  %s>>>%c<<<%s\n",
            error_head, error_char, error_ptr);
    if (error_tail)  *error_tail = '\n';
    error_ptr[-1] = tem;
  }
}

//---------------------------ensure_start_of_line------------------------------
// A preprocessor directive has been encountered.  Be sure it has fallen at
// the beginning of a line, or else report an error.
void ADLParser::ensure_start_of_line(void) {
  if (_curchar == '\n') { next_line(); return; }
  assert( _ptr >= _curline && _ptr < _curline+strlen(_curline),
          "Must be able to find which line we are in" );

  for (char *s = _curline; s < _ptr; s++) {
    if (*s > ' ') {
      parse_err(SYNERR, "'%c' must be at beginning of line\n", _curchar);
      break;

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Fix the character immediately after the '>>>' marker in the referenced .ad file line
  2. Use the head/tail text to locate the exact construct (instruction, operand, encode clause)
  3. Rerun adlc to confirm the context no longer appears
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Any ADLParser::parse_err(..., 1) call: bad token in a .ad file triggers sync-to-end-of-line, then this context dump showing exactly which character the parser choked on.

Common situations: Interpreting adlc failure logs while editing .ad files; the caret-style pointer removes guesswork about which character of a long match-rule line is malformed.

Related errors


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