{"abstract":"The earliest optimization wins.","category":"Build systems","checks":6,"contract":"Append defaults, replace optimization options by the last requested optimization, preserve repeated include options, remove explicitly disabled warnings, and append mandatory flags exactly once.","contract_signature":"defaults, requested, disabled, mandatory","evaluation_group":"xt-compiler-flags","failed_approach":"The attempted repair substitutes opts[len(opts)//2-1]. Fixture 2 still yields ['-Ifoo', '-Ifoo', '-O0', '-g'] instead of ['-Ifoo', '-Ifoo', '-O2', '-g'].","family":"xt-compiler-flags-last-opt","id":"FA-9271","implementations":{"attempt":{"sha256":"2d59c617d6dccbdd098bf49f4611ce2fa0676088f50c1bc9985b08108e72e209","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(defaults, requested, disabled, mandatory):\n    flags = list(defaults) + list(requested)\n    opts = [x for x in flags if x.startswith('-O')]\n    flags = [x for x in flags if not x.startswith('-O')]\n    flags = [x for x in flags if x not in disabled]\n    if opts: flags.append(opts[len(opts)//2-1])\n    for flag in mandatory:\n        if flag not in flags: flags.append(flag)\n    return flags\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1', solve([], [], [], []), [])\ncheck('fixture 2', solve(['-O0', '-Wall'], ['-O2', '-Ifoo', '-Ifoo'], ['-Wall'], ['-g']), ['-Ifoo', '-Ifoo', '-O2', '-g'])\ncheck('fixture 3', solve(['-O1'], ['-O3'], [], []), ['-O3'])\ncheck('fixture 4', solve(['-g'], [], [], ['-g']), ['-g'])\ncheck('fixture 5', solve(['-Wa', '-Wb'], [], ['-Wa'], []), ['-Wb'])\ncheck('fixture 6', solve([], ['-Ifoo', '-Ibar'], [], ['-g', '-g']), ['-Ifoo', '-Ibar', '-g'])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"7a25a289a42e1b0a7aad9b292cbcae308d299f4d6c7bce84911645e7178b158d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(defaults, requested, disabled, mandatory):\n    flags = list(defaults) + list(requested)\n    opts = [x for x in flags if x.startswith('-O')]\n    flags = [x for x in flags if not x.startswith('-O')]\n    flags = [x for x in flags if x not in disabled]\n    if opts: flags.append(opts[0])\n    for flag in mandatory:\n        if flag not in flags: flags.append(flag)\n    return flags\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1', solve([], [], [], []), [])\ncheck('fixture 2', solve(['-O0', '-Wall'], ['-O2', '-Ifoo', '-Ifoo'], ['-Wall'], ['-g']), ['-Ifoo', '-Ifoo', '-O2', '-g'])\ncheck('fixture 3', solve(['-O1'], ['-O3'], [], []), ['-O3'])\ncheck('fixture 4', solve(['-g'], [], [], ['-g']), ['-g'])\ncheck('fixture 5', solve(['-Wa', '-Wb'], [], ['-Wa'], []), ['-Wb'])\ncheck('fixture 6', solve([], ['-Ifoo', '-Ibar'], [], ['-g', '-g']), ['-Ifoo', '-Ibar', '-g'])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":" This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xt-compiler-flags-last-opt","generated_at":"2026-09-29T14:38:28.606971+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline model of compiler option precedence, suitable for testing build and release tooling without external services.","root_cause":"The implementation substitutes opts[0] for opts[-1], so the earliest optimization wins.","sha256":"25e92f01849022a63f9a4ab849443240cde6393d1768a28d064670c9423f6465","title":"Compiler option precedence: The earliest optimization wins · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":37.895,"exit_code":1,"observations":[{"actual":[],"check":"fixture 1","expected":[],"passed":true},{"actual":["-Ifoo","-Ifoo","-O0","-g"],"check":"fixture 2","expected":["-Ifoo","-Ifoo","-O2","-g"],"passed":false},{"actual":["-O1"],"check":"fixture 3","expected":["-O3"],"passed":false},{"actual":["-g"],"check":"fixture 4","expected":["-g"],"passed":true},{"actual":["-Wb"],"check":"fixture 5","expected":["-Wb"],"passed":true},{"actual":["-Ifoo","-Ibar","-g"],"check":"fixture 6","expected":["-Ifoo","-Ibar","-g"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"fixture 2\", \"actual\": [\"-Ifoo\", \"-Ifoo\", \"-O0\", \"-g\"], \"expected\": [\"-Ifoo\", \"-Ifoo\", \"-O2\", \"-g\"], \"passed\": false}, {\"check\": \"fixture 3\", \"actual\": [\"-O1\"], \"expected\": [\"-O3\"], \"passed\": false}, {\"check\": \"fixture 4\", \"actual\": [\"-g\"], \"expected\": [\"-g\"], \"passed\": true}, {\"check\": \"fixture 5\", \"actual\": [\"-Wb\"], \"expected\": [\"-Wb\"], \"passed\": true}, {\"check\": \"fixture 6\", \"actual\": [\"-Ifoo\", \"-Ibar\", \"-g\"], \"expected\": [\"-Ifoo\", \"-Ibar\", \"-g\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":36.567,"exit_code":1,"observations":[{"actual":[],"check":"fixture 1","expected":[],"passed":true},{"actual":["-Ifoo","-Ifoo","-O0","-g"],"check":"fixture 2","expected":["-Ifoo","-Ifoo","-O2","-g"],"passed":false},{"actual":["-O1"],"check":"fixture 3","expected":["-O3"],"passed":false},{"actual":["-g"],"check":"fixture 4","expected":["-g"],"passed":true},{"actual":["-Wb"],"check":"fixture 5","expected":["-Wb"],"passed":true},{"actual":["-Ifoo","-Ibar","-g"],"check":"fixture 6","expected":["-Ifoo","-Ibar","-g"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"fixture 2\", \"actual\": [\"-Ifoo\", \"-Ifoo\", \"-O0\", \"-g\"], \"expected\": [\"-Ifoo\", \"-Ifoo\", \"-O2\", \"-g\"], \"passed\": false}, {\"check\": \"fixture 3\", \"actual\": [\"-O1\"], \"expected\": [\"-O3\"], \"passed\": false}, {\"check\": \"fixture 4\", \"actual\": [\"-g\"], \"expected\": [\"-g\"], \"passed\": true}, {\"check\": \"fixture 5\", \"actual\": [\"-Wb\"], \"expected\": [\"-Wb\"], \"passed\": true}, {\"check\": \"fixture 6\", \"actual\": [\"-Ifoo\", \"-Ibar\", \"-g\"], \"expected\": [\"-Ifoo\", \"-Ibar\", \"-g\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}