public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42743] New: Inexplicable error message with constructing SIMD values
@ 2010-01-14 12:01 bisqwit at iki dot fi
2010-01-14 12:36 ` [Bug c++/42743] " jwakely dot gcc at gmail dot com
0 siblings, 1 reply; 3+ messages in thread
From: bisqwit at iki dot fi @ 2010-01-14 12:01 UTC (permalink / raw)
To: gcc-bugs
This code:
#include <emmintrin.h>
template<typename vec_t>
void x()
{
vec_t tmp1 = vec_t(); // Works with myvec, causes error with __m128
vec_t tmp2 = {}; // Causes warnings about uninitialized members in
myvec
vec_t tmp3; // This may cause a warning about use of
uninitialized variables if tmp3 is later read-accessed.
}
struct myvec
{
struct tmp
{
float data[2];
} d;
};
void y()
{
x<__m128> ();
x<myvec> ();
}
Produces this error when vec_t is __m128:
tmp.cc:6: error: can't convert between vector values of different size
And this warning when vec_t is myvec:
tmp.cc:7: warning: missing initializer for member 'myvec::d'
It is my understanding that constructor calls should never be treated as syntax
errors. Is there really no way to write this code so that it causes neither a
compile error or a warning?
--
Summary: Inexplicable error message with constructing SIMD values
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bisqwit at iki dot fi
GCC build triplet: x86_64-pc-linux-gnu
GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42743
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/42743] Inexplicable error message with constructing SIMD values
2010-01-14 12:01 [Bug c++/42743] New: " bisqwit at iki dot fi
@ 2010-01-14 12:36 ` jwakely dot gcc at gmail dot com
0 siblings, 0 replies; 3+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2010-01-14 12:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jwakely dot gcc at gmail dot com 2010-01-14 12:36 -------
(In reply to comment #0)
> vec_t tmp2 = {}; // Causes warnings about uninitialized members in
> myvec
The warning doesn't smean it's uninitialized, just that there are not
initializers present for all members:
-Wmissing-field-initializers
Warn if a structure's initializer has some fields missing. For
example, the following code would cause such a warning, because "x.h" is
implicitly
zero:
struct s { int f, g, h; };
struct s x = { 3, 4 };
You can disable that with -Wno-missing-field-initializers (but that doesn't
help for cases where vec_t cannot be aggregate initialized)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42743
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-22 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-42743-4@http.gcc.gnu.org/bugzilla/>
2011-10-15 21:27 ` [Bug c++/42743] Inexplicable error message with constructing SIMD values paolo.carlini at oracle dot com
2021-07-22 18:35 ` pinskia at gcc dot gnu.org
2010-01-14 12:01 [Bug c++/42743] New: " bisqwit at iki dot fi
2010-01-14 12:36 ` [Bug c++/42743] " jwakely dot gcc at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).