{"record":{"id":"e720d890e52f0a62","repo":"openjdk/jdk","slug":"error-more-than-one-register-has-been-assigned-re","errorCode":null,"errorMessage":"ERROR: More than one register has been assigned register-number 0.\nProbably because a register has not been entered into an allocation class.\n","messagePattern":"ERROR: More than one register has been assigned register-number 0\\.\nProbably because a register has not been entered into an allocation class\\.\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/hotspot/share/adlc/formsopt.cpp","lineNumber":157,"sourceCode":"  // Verify Register Classes\n  // check that each register class contains registers from one chunk\n  const char *rc_name = nullptr;\n  _rclasses.reset();\n  while ( (rc_name = _rclasses.iter()) != nullptr ) {\n    // Check the chunk value for all registers in this class\n    RegClass *reg_class = getRegClass(rc_name);\n    assert( reg_class != nullptr, \"InternalError() no matching register class\");\n  } // end of RegClasses\n\n  // Verify that every register has been placed into an allocation class\n  RegDef *reg_def = nullptr;\n  reset_RegDefs();\n  uint  num_register_zero = 0;\n  while ( (reg_def = iter_RegDefs()) != nullptr ) {\n    if( reg_def->register_num() == 0 )  ++num_register_zero;\n  }\n  if( num_register_zero > 1 ) {\n    fprintf(stderr,\n            \"ERROR: More than one register has been assigned register-number 0.\\n\"\n            \"Probably because a register has not been entered into an allocation class.\\n\");\n  }\n\n  return  valid;\n}\n\n// Compute the least number of words required for registers in register masks.\nint RegisterForm::words_for_regs() {\n  return (_reg_ctr + 31) >> 5;\n}\n\n// Compute RegMask size\nint RegisterForm::RegMask_Size() {\n  // The array of Register Mask bits should be large enough to cover all the\n  // machine registers, as well as a certain number of parameters that need to\n  // be passed on the stack (stack registers). The number of parameters that can\n  // fit in the mask should be dimensioned to cover most common cases.","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/hotspot/share/adlc/formsopt.cpp#L139-L175","documentation":"RegisterForm verification error in ADLC: after processing all register classes, more than one RegDef still reports register_num() == 0. Registers not entered into any allocation class keep the default number 0, and multiple such registers collide, which would produce corrupt register masks in the generated matcher code. ADLC prints this 'ERROR:' and the RegisterForm::verify() result marks the file invalid.","triggerScenarios":"Declaring a register in 'reg_def' but omitting it from every 'reg_class' / allocation-class definition in the .ad file; two or more such omissions trigger the >1 count. Register numbering is assigned only as classes are iterated (see the preceding RegClasses loop).","commonSituations":"Adding a new physical register (e.g. a new vector register) and forgetting the reg_class membership; reordering or renaming reg_class blocks so a def no longer matches; porting .ad files between architectures.","solutions":["Add each unassigned register to at least one reg_class in the register block of the .ad file","Cross-check every 'reg_def' name appears inside some 'reg_class ... %name ...' declaration","Rerun adlc and confirm the ERROR no longer prints before trusting generated adfiles"],"exampleFix":"// before\nreg_def R8  reg_def R9   // never added to a class\nreg_class ptr_r reg_read_r;\n\n// after\nreg_class ptr_r reg_read_r R8 R9;","handlingStrategy":"validation","validationCode":"# every reg_def name must appear inside some reg_class body\nfor r in $(grep -oP '(?<=^reg_def )\\S+' x86_64.ad); do grep -q \"reg_class.*[({].*\\b$r\\b\" x86_64.ad || echo \"register $r not in any allocation class\"; done","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add every new reg_def to at least one reg_class in the same change","Grep each register name against reg_class blocks before building","Treat this ERROR as blocking: generated masks would be corrupt"],"tags":["adlc","register-class","build","hotspot","configuration"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}