Closed yosupo06 closed 3 years ago
CXX=g++-10 oj-verify run
をした場合出力からソースコードが消えました。macなので g++
は clang++
へのエイリアスになっています
これはよくないですね。提出先の問題をマクロを流用して定義する仕様がかなり失敗だった感があり、ちょうどそのうち置き換えたいなと思っていたところでした。そのうちなんとかします。数十行のシェルスクリプトだったときのハックとしてはマクロはそう悪くなかったはずで、いわゆる技術的負債というやつですね。
workaround としては $CXX
を指定してもらう以外に、提出先の問題などの指定を #define [KEY] [VALUE]
でなく // verification-helper: [KEY] [VALUE]
の形で書くというものがあります。これがあるとマクロの検査が省略される (高速化にもなる) ので、出力は消えると思います。この指定方法はまだ undocumented なのですが、そのうち documented にする予定のものです。
// verification-helper: PROBLEM https://judge.yosupo.jp/problem/many_aplusb
に書き換えてみましたが、状況は変わりませんでした(CXX=g++-10
をつけた場合のみ正常に動作) 😢
となると、依存関係の解析が問題を起こしている気がします。互換性問題があるとすればマクロの周辺でしょと思ってしまいましたが、別の怪しい処理として依存関係の解析もあることを忘れていました。
@yosupo06 今のところ以下のようなコマンドで処理をしています。どれが悪いのか試してみてほしいです。
g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 -dM -E main.cpp
g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 -MD -MF output.txt -MM main.cpp
g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 main.cpp
と clang++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 main.cpp
ちなみに、私の Ubuntu の環境 (g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 / clang version 6.0.0-1ubuntu2) では g++ を clang++ に置き換えて試しても特に問題なく動きます。
g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 -dM -E test-oj/aplusb.test.cpp -I .
3000行ほど出てきました。ここに全てを貼ることは出来ないため、独断で一部を抜き出したものが以下です
$ g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 -dM -E test-oj/aplusb.test.cpp -I .
clang: warning: -Wl,-stack_size,0x10000000: 'linker' input unused [-Wunused-command-line-argument]
#define ACCESSX_MAX_DESCRIPTORS 100
#define ACCESSX_MAX_TABLESIZE (16 * 1024)
#define ARG_MAX (256 * 1024)
#define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
#define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
#define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
#define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
#define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
#define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
#define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
#define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
#define ATOMIC_VAR_INIT(__v) {__v}
#define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
:
#define _LC_LAST_MASK (1 << (_LC_NUM_MASK - 1))
#define _LC_NUM_MASK 6
#define _LIBCPP_ABI_ITANIUM
#define _LIBCPP_ABI_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
#define _LIBCPP_ABI_VERSION 1
:
#define __AVAILABILITY_INTERNAL__IPHONE_NA __attribute__((availability(ios,unavailable)))
#define __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA __attribute__((availability(ios,unavailable)))
#define __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA_MSG(_msg) __attribute__((availability(ios,unavailable)))
#define __AVAILABILITY_INTERNAL__IPHONE_NA__IPHONE_NA __attribute__((availability(ios,unavailable)))
#define __AVAILABILITY_INTERNAL__MAC_10_0 __attribute__((availability(macosx,introduced=10.0)))
#define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_0 __attribute__((availability(macosx,introduced=10.0,deprecated=10.0)))
#define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_0_MSG(_msg) __attribute__((availability(macosx,introduced=10.0,deprecated=10.0,message=_msg)))
#define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_1 __attribute__((availability(macosx,introduced=10.0,deprecated=10.1)))
#define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10 __attribute__((availability(macosx,introduced=10.0,deprecated=10.10)))
#define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_10_2 __attribute__((availability(macosx,introduced=10.0,deprecated=10.10.2)))
:
#define sa_sigaction __sigaction_u.__sa_sigaction
#define sigmask(m) (1 << ((m)-1))
#define stderr __stderrp
#define stdin __stdinp
#define stdout __stdoutp
#define sv_onstack sv_flags
#define va_arg(ap,type) __builtin_va_arg(ap, type)
#define va_copy(dest,src) __builtin_va_copy(dest, src)
#define va_end(ap) __builtin_va_end(ap)
#define va_start(ap,param) __builtin_va_start(ap, param)
#define w_coredump w_T.w_Coredump
#define w_retcode w_T.w_Retcode
#define w_stopsig w_S.w_Stopsig
#define w_stopval w_S.w_Stopval
#define w_termsig w_T.w_Termsig
g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 -MD -MF output.txt -MM test-oj/aplusb.test.cpp -I .
数万行の(標準ライブラリもすべて展開されたと思わしき)ソースコードが標準出力に出力されました。おそらく当初のoj-verify run
で出力されるものと同一だと思われます。
g++ -std=c++17 -O2 -Wall -g -Wl,-stack_size,0x10000000 test-oj/aplusb.test.cpp -I .
コンパイルが出来て、期待通りのもの(Many A + Bの解答となるバイナリ)が./a.out
に出力されました。
役に立つかもしれない情報を追記します。
$ g++ --help
:
:
-MD Write a depfile containing user and system headers
-meabi <value> Set EABI type, e.g. 4, 5 or gnu (default depends on triple)
-membedded-data Place constants in the .rodata section instead of the .sdata section even if they meet the -G <size> threshold (MIPS)
-mexecute-only Disallow generation of data access to code sections (ARM only)
-mextern-sdata Assume that externally defined data is in the small data if it meets the -G <size> threshold (MIPS)
-mfentry Insert calls to fentry at function entry (x86/SystemZ only)
-mfix-cortex-a53-835769 Workaround Cortex-A53 erratum 835769 (AArch64 only)
-mfp32 Use 32-bit floating point registers (MIPS only)
-mfp64 Use 64-bit floating point registers (MIPS only)
-MF <file> Write depfile output from -MMD, -MD, -MM, or -M to <file>
-mgeneral-regs-only Generate code which only uses the general purpose registers (AArch64 only)
-mglobal-merge Enable merging of globals
-mgpopt Use GP relative accesses for symbols known to be in a small data section (MIPS)
-MG Add missing headers to depfile
-mhvx-length=<value> Set Hexagon Vector Length
-mhvx=<value> Enable Hexagon Vector eXtensions
-mhvx Enable Hexagon Vector eXtensions
-miamcu Use Intel MCU ABI
--migrate Run the migrator
-mincremental-linker-compatible
(integrated-as) Emit an object file which can be used with an incremental linker
-mindirect-jump=<value> Change indirect jump instructions to inhibit speculation
-mios-version-min=<value>
Set iOS deployment target
-MJ <value> Write a compilation database entry per input
-mllvm <value> Additional arguments to forward to LLVM's option processing
-mlocal-sdata Extend the -G behaviour to object local data (MIPS)
-mlong-calls Generate branches with extended addressability, usually via indirect jumps.
-mlong-double-128 Force long double to be 128 bits
-mlong-double-64 Force long double to be 64 bits
-mlong-double-80 Force long double to be 80 bits, padded to 128 bits for storage
-mmacosx-version-min=<value>
Set Mac OS X deployment target
-mmadd4 Enable the generation of 4-operand madd.s, madd.d and related instructions.
-MMD Write a depfile containing user headers
-mmemops Enable generation of memop instructions
-mms-bitfields Set the default structure layout to be compatible with the Microsoft compiler standard
-mmsa Enable MSA ASE (MIPS only)
-mmt Enable MT ASE (MIPS only)
-MM Like -MMD, but also implies -E and writes to stdout by default
-mno-abicalls Disable SVR4-style position-independent code (Mips only)
-mno-code-object-v3 Disable code object v3 (AMDGPU only)
-mno-crc Disallow use of CRC instructions (Mips only)
-mno-cumode WGP wavefront execution mode is used (AMDGPU only)
-mno-embedded-data Do not place constants in the .rodata section instead of the .sdata if they meet the -G <size> threshold (MIPS)
-mno-execute-only Allow generation of data access to code sections (ARM only)
-mno-extern-sdata Do not assume that externally defined data is in the small data if it meets the -G <size> threshold (MIPS)
-mno-fix-cortex-a53-835769
Don't workaround Cortex-A53 erratum 835769 (AArch64 only)
-mno-global-merge Disable merging of globals
-mno-gpopt Do not use GP relative accesses for symbols known to be in a small data section (MIPS)
-mno-hvx Disable Hexagon Vector eXtensions
-mno-implicit-float Don't generate implicit floating point instructions
-mno-incremental-linker-compatible
(integrated-as) Emit an object file which cannot be used with an incremental linker
-mno-local-sdata Do not extend the -G behaviour to object local data (MIPS)
-mno-long-calls Restore the default behaviour of not generating long calls
-mno-madd4 Disable the generation of 4-operand madd.s, madd.d and related instructions.
-mno-memops Disable generation of memop instructions
-mno-movt Disallow use of movt/movw pairs (ARM only)
-mno-ms-bitfields Do not set the default structure layout to be compatible with the Microsoft compiler standard
-mno-msa Disable MSA ASE (MIPS only)
-mno-mt Disable MT ASE (MIPS only)
-mno-neg-immediates Disallow converting instructions with negative immediates to their negation or inversion.
-mno-nvj Disable generation of new-value jumps
-mno-nvs Disable generation of new-value stores
-mno-outline Disable function outlining (AArch64 only)
-mno-packets Disable generation of instruction packets
-mno-relax Disable linker relaxation
-mno-restrict-it Allow generation of deprecated IT blocks for ARMv8. It is off by default for ARMv8 Thumb mode
-mno-save-restore Disable using library calls for save and restore
-mno-sram-ecc Disable SRAM ECC (AMDGPU only)
-mno-stack-arg-probe Disable stack probes which are enabled by default
-mno-tls-direct-seg-refs
Disable direct TLS access through segment registers
-mno-unaligned-access Force all memory accesses to be aligned (AArch32/AArch64 only)
-mno-wavefrontsize64 Wavefront size 32 is used
-mno-xnack Disable XNACK (AMDGPU only)
-mnocrc Disallow use of CRC instructions (ARM only)
-mnop-mcount Generate mcount/__fentry__ calls as nops. To activate they need to be patched in.
-mnvj Enable generation of new-value jumps
-mnvs Enable generation of new-value stores
-module-dependency-dir <value>
Directory to dump module dependencies to
-module-file-info Provide information about a particular module file
-momit-leaf-frame-pointer
Omit frame pointer setup for leaf functions
-moutline Enable function outlining (AArch64 only)
-mpacked-stack Use packed stack layout (SystemZ only).
-mpackets Enable generation of instruction packets
-mpie-copy-relocations Use copy relocations support for PIE builds
-mprefer-vector-width=<value>
Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.
-MP Create phony target for each dependency (other than main file)
-mqdsp6-compat Enable hexagon-qdsp6 backward compatibility
-MQ <value> Specify name of main file output to quote in depfile
-mrecord-mcount Generate a __mcount_loc section entry for each __fentry__ call.
-mrelax-all (integrated-as) Relax all machine instructions
-mrelax Enable linker relaxation
-mrestrict-it Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.
-mrtd Make StdCall calling convention the default
-msave-restore Enable using library calls for save and restore
-msign-return-address=<value>
Select return address signing scope
-msoft-float Use software floating point
-msram-ecc Enable SRAM ECC (AMDGPU only)
-mstack-alignment=<value>
Set the stack alignment
-mstack-arg-probe Enable stack probes
-mstack-probe-size=<value>
Set the stack probe size
-mstackrealign Force realign the stack at entry to every function
-mthread-model <value> The thread model to use, e.g. posix, single (posix by default)
-mtls-direct-seg-refs Enable direct TLS access through segment registers (default)
-mtp=<value> Thread pointer access method (AArch32/AArch64 only)
-MT <value> Specify name of main file output in depfile
-munaligned-access Allow memory accesses to be unaligned (AArch32/AArch64 only)
-MV Use NMake/Jom format for the depfile
-mwavefrontsize64 Wavefront size 64 is used
-mxnack Enable XNACK (AMDGPU only)
-M Like -MD, but also implies -E and writes to stdout by default
:
:
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
また、-MD
をつけるか否かで標準出力に出力されるかが変化されるように見えます。実際に
g++ -std=c++17 -O2 test-oj/aplusb.test.cpp -I . -MM -MF output.txt
ならば何も標準出力に出力されず、output.txt
は次のようになります
$ cat output.txt
aplusb.test.o: test-oj/aplusb.test.cpp yosupo/fastio.hpp yosupo/bit.hpp \
yosupo/internal_type_traits.hpp
Summary / 概要
手元で
oj-verify run
を実行すると数万行の出力が出てきます。Steps to reproduce / 再現方法
feature/oj
branchを手元にclone、トップでoj-verify run
を実行environments:
Expected behavior / 期待される挙動
Actual behavior / 実際の挙動
Other notes / その他