Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling with _GLIBCXX_DEBUG gives errors #3221

Closed
2 tasks done
notestaff opened this issue Jan 14, 2024 · 4 comments · Fixed by #3222
Closed
2 tasks done

compiling with _GLIBCXX_DEBUG gives errors #3221

notestaff opened this issue Jan 14, 2024 · 4 comments · Fixed by #3222
Labels
bug faulty or wrong behaviour of code

Comments

@notestaff
Copy link

notestaff commented Jan 14, 2024

Does this problem persist on the current master?

  • I have verified the issue on the current master

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Compiling a seqan3-dependent program with -D_GLIBCXX_DEBUG (debug mode) gives errors that don't happen without debug mode:

In file included from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/marti2/include/marti2/marti2_utils.hpp:17,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/marti2/marti2_utils.cpp:9:
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/nucleotide/dna4.hpp: In function 'constexpr seqan3::dna4_vector seqan3::literals::operator""_dna4(const char*, std::size_t)':
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/nucleotide/dna4.hpp:260:17: error: variable 'r' of non-literal type 'seqan3::dna4_vector' {aka 'std::__debug::vector<seqan3::dna4>'} in 'constexpr' function only available with '-std=c++2b' or '-std=gnu++2b'
  260 |     dna4_vector r;
      |                 ^
In file included from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/x86_64-conda-linux-gnu/include/c++/12.3.0/vector:74,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/x86_64-conda-linux-gnu/include/c++/12.3.0/functional:62,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/submodules/cereal/include/cereal/cereal.hpp:35,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/submodules/cereal/include/cereal/archives/binary.hpp:32,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/core/concept/cereal.hpp:20,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/concept.hpp:18,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/views/char_strictly_to.hpp:17,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/marti2/marti2_utils.cpp:2:
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/x86_64-conda-linux-gnu/include/c++/12.3.0/debug/vector:117:11: note: 'std::__debug::vector<seqan3::dna4>' is not literal because:
  117 |     class vector
      |           ^~~~~~
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/x86_64-conda-linux-gnu/include/c++/12.3.0/debug/vector:117:11: note:   'std::__debug::vector<seqan3::dna4>' does not have 'constexpr' destructor
In file included from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/aminoacid/all.hpp:70,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/all.hpp:185,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/marti2/include/marti2/marti2_defs.hpp:11,
                 from /data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/marti2/include/marti2/marti2_utils.hpp:20:
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/aminoacid/aa10li.hpp: In function 'constexpr seqan3::aa10li_vector seqan3::literals::operator""_aa10li(const char*, size_t)':
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/include/seqan3/alphabet/aminoacid/aa10li.hpp:233:19: error: variable 'r' of non-literal type 'seqan3::aa10li_vector' {aka 'std::__debug::vector<seqan3::aa10li>'} in 'constexpr' function only available with '-std=c++2b' or '-std=gnu++2b'
  233 |     aa10li_vector r;
      |                   ^
/data/ilya/iwork/marti/tmp/wtree/is-231002-1155-marti-cpp/build/marti2_envs/x86_64-conda-linux-gnu/include/c++/12.3.0/debug/vector:117:11: note: 'std::__debug::vector<seqan3::aa10li>' is not literal because:
  117 |     class vector
      |           ^~~~~~

Expected Behavior

We'd like to compile a seqan3-dependent program under C++20 standard in debug mode, without errors.

Steps To Reproduce

Add -D_GLIBCXX_DEBUG when compiling.

Environment

`
uname -a
Linux bpb23-acc 5.4.0-136-generic #153-Ubuntu SMP Thu Nov 24 15:56:58 UTC 2022 x86_64 GNU/Linux

$CXX --version
x86_64-conda-linux-gnu-c++ (conda-forge gcc 12.3.0-2) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
conda env export | grep seqan3
  - seqan3=3.3.0=hdfd78af_0
`

Anything else?

As always, thanks for your work on seqan!

@eseiler

@notestaff notestaff added the bug faulty or wrong behaviour of code label Jan 14, 2024
@eseiler
Copy link
Member

eseiler commented Jan 15, 2024

Hey there,

I'll look at this on Wednesday (still on holiday today and tomorrow).

It should only use constexpr vectors if the compiler supports it and our nightlies with glibcxx_debug also work, but they might just not cover your use case.

Do you have a minimal example that fails to compile? I. E., how do you use the alphabet vector?

@SGSSGene
Copy link
Contributor

I can confirm this bug on godbolt with the newest seqan version (it works with seqan 3.2.0):
https://godbolt.org/z/fzfTqfdbq

@SGSSGene
Copy link
Contributor

SGSSGene commented Jan 15, 2024

I believe this is a bug in gcc/libstdc++
We can reproduce it here (without seqan): https://godbolt.org/z/oTfhEWrvd

I found this entry on bugzilla, showing at least one person is aware of this issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104748

To solve this, we don't guarentee that ""_dna is constexpr, we could put in another switch, removing the constexpr if -D_GLIBCXX_DEBUG is set, what do you think @eseiler ?

@SGSSGene
Copy link
Contributor

I suggested following fix: #3222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug faulty or wrong behaviour of code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants