Skip to content

oj-bundle no longer works with avx2 GCC pragma #438

@adamant-pwn

Description

@adamant-pwn

Summary / 概要

oj-bundle command no longer works for me with files that contain #pragma GCC target("avx2,tune=native"), as it triggers assert len(lines) == len(uncommented_lines).

When trying to see the difference between them, it seems that lines look as follows:

#pragma GCC target("avx2,tune=native")

While uncommented_lines, for some reason, unwrap to

#pragma GCC target("avx2,tune=native")
#undef __code_model_small__
#undef __MMX_WITH_SSE__
#define __code_model_small__ 1
#define __SSE3__ 1
#define __SSSE3__ 1
#define __SSE4_1__ 1
#define __SSE4_2__ 1
#define __AVX__ 1
#define __AVX2__ 1
#define __CRC32__ 1
#define __POPCNT__ 1
#define __XSAVE__ 1
#define __MMX_WITH_SSE__ 1

I assume it might be related to a GCC update, as it was running fine previously:

$ g++ --version
g++ (GCC) 14.1.1 20240507
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Steps to reproduce / 再現方法

  1. Create a file consisting of a single line #pragma GCC target("avx2,tune=native").
  2. Run oj-bundle on it.

environments:

$ cat .verify-helper/config.toml 
[[languages.cpp.environments]]
CXX = "g++"
CXXFLAGS = ["-std=c++20", "-Wall", "-Wextra", "-O2", "-mavx2"]
  • version: (please write the versions of related things, e.g. $ oj --version)

online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.1)

Expected behavior / 期待される挙動

INFO:onlinejudge_verify.config:config file loaded: .verify-helper/config.toml: {'languages': {'cpp': {'environments': [{'CXX': 'g++', 'CXXFLAGS': ['-std=c++20', '-Wall', '-Wextra', '-O2', '-mavx2']}]}}}
#line 1 "main.test.cpp"
#pragma GCC target("avx2,tune=native")

Actual behavior / 実際の挙動

INFO:onlinejudge_verify.config:config file loaded: .verify-helper/config.toml: {'languages': {'cpp': {'environments': [{'CXX': 'g++', 'CXXFLAGS': ['-std=c++20', '-Wall', '-Wextra', '-O2', '-mavx2']}]}}}

Traceback (most recent call last):
  File "/home/adamant/.local/bin/oj-bundle", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/adamant/.local/lib/pypy3.10/site-packages/onlinejudge_bundle/main.py", line 30, in main
    sys.stdout.buffer.write(language.bundle(parsed.path, basedir=parsed.iquote[0], options={'include_paths': parsed.iquote}))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/adamant/.local/lib/pypy3.10/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/home/adamant/.local/lib/pypy3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 295, in update
    assert len(lines) == len(uncommented_lines)
AssertionError

Other notes / その他

  • Will you try to create a pull request?
    • no

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions