Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-11-08 Thread Mathias Fröhlich
Good Morning,

I can confirm that the new build gcc-8.2.1-5 from jakub already
available in *-testing fixes the problem for me.

Thanks!!

Mathias


On Saturday, 3 November 2018 15:31:32 CET Mathias Fröhlich wrote:
> Hi,
> 
> > > Before filing a bug report at gcc I wanted to verify that we are not 
> > > doing anything
> > > wrong like with aliasing for example. Which is the reason the bug is not 
> > > filed yet.
> > 
> > FYI I filed a bug in fedora, and Jakub tracked it down and is working
> > it upstream at:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87859
> 
> Thanks a lot!!!
> 
> Mathias
> 
> 
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 




___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-11-03 Thread Mathias Fröhlich
Hi,

> > Before filing a bug report at gcc I wanted to verify that we are not doing 
> > anything
> > wrong like with aliasing for example. Which is the reason the bug is not 
> > filed yet.
> 
> FYI I filed a bug in fedora, and Jakub tracked it down and is working
> it upstream at:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87859

Thanks a lot!!!

Mathias



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-11-03 Thread Dave Airlie
Thanks Mathias,

>
> Before filing a bug report at gcc I wanted to verify that we are not doing 
> anything
> wrong like with aliasing for example. Which is the reason the bug is not 
> filed yet.

FYI I filed a bug in fedora, and Jakub tracked it down and is working
it upstream at:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87859

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-11-02 Thread Mathias Fröhlich
Hi,

On Friday, 2 November 2018 06:22:13 CET Dave Airlie wrote:
> On Tue, 23 Oct 2018 at 10:57, Eric Anholt  wrote:
> >
> > Eric Engestrom  writes:
> >
> > > Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
> > > time this macro is used.
> 
> This seems to be causing problems for me here on gcc8 (8.0.1 and
> 8.2.1) in Fedora 28.
> 
> ./bin/texelFetch fs usampler2DMS 2
> 
> is failing here with:
> Failed to compile fragment shader: 0:6(1): error: invalid input layout
> qualifier used
> 
> gcc is probably broken, but we might want to revert his from the tree
> and upcoming release until we can figure it out.

I have been experiencing something similar on fedora 28.

The observation is that gcc-8.2.1-3 works correct and gcc-8.2.1-4 does
show this problem. So for myself I have been nailing down the rpm version
of the gcc packet not to update. That helps as first aid but is not exactly 
nice.

There is now also a reduced source that does not require a full mesa compile
to ease a bug report. The file is attached here. You need -O2 to make it fail.

Before filing a bug report at gcc I wanted to verify that we are not doing 
anything
wrong like with aliasing for example. Which is the reason the bug is not filed 
yet.

Now, I don't find time to put more work into that at the weekend and
probably also not next week. So if anybody of you wants accelerate the process,
double checks that we don't do something wrong and hand that over to gcc
I would not mind!

There is also an observation that the new gcc rpm includes the fix for gcc
bug 87137 that actually turns out to be a bitfield layouting problem.
If fedora wants to experiment with a fedora only fix its probably a good
starting point to check if omitting the corresponding patch for bug 87137
does actually help on linux. Well that is pure speculation from my side.

... so far the dump from my side on that problem.

best

Mathias#include 

#include 

#define BITSET_WORD unsigned int
#define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
#define BITSET_WORDS(bits) (((bits) + BITSET_WORDBITS - 1) / BITSET_WORDBITS)
#define BITSET_EQUAL(x, y) (std::memcmp( (x), (y), sizeof (x) ) == 0)

#define DECLARE_BITSET_T(T, N) struct T {   \
\
  T &   \
  operator=(int x)  \
  { \
 const T c = {{ (BITSET_WORD)x }};  \
 return *this = c;  \
  } \
\
  friend bool   \
  operator==(const T , const T )\
  { \
 return BITSET_EQUAL(b.words, c.words); \
  } \
\
  friend bool   \
  operator!=(const T , const T )\
  { \
 return !(b == c);  \
  } \
\
  friend bool   \
  operator==(const T , int x) \
  { \
 const T c = {{ (BITSET_WORD)x }};  \
 return b == c; \
  } \
\
  friend bool   \
  operator!=(const T , int x) \
  { \
 return !(b == x);  \
  } \
\
  friend T  \
  operator~(const T ) \
  { \
 T c;   \
 for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
c.words[i] = ~b.words[i];   \
 return c;  \
  } \
 

Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-11-02 Thread Dave Airlie
On Fri, 2 Nov 2018 at 15:22, Dave Airlie  wrote:
>
> On Tue, 23 Oct 2018 at 10:57, Eric Anholt  wrote:
> >
> > Eric Engestrom  writes:
> >
> > > Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
> > > time this macro is used.
>
> This seems to be causing problems for me here on gcc8 (8.0.1 and
> 8.2.1) in Fedora 28.
>
> ./bin/texelFetch fs usampler2DMS 2
>
> is failing here with:
> Failed to compile fragment shader: 0:6(1): error: invalid input layout
> qualifier used
>
> gcc is probably broken, but we might want to revert his from the tree
> and upcoming release until we can figure it out.

Actually not related to this, it looks like gcc 8.2.1 has broken out bitset.

I probably won't get to this until next week so if someone else has
time, feel free.

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-11-01 Thread Dave Airlie
On Tue, 23 Oct 2018 at 10:57, Eric Anholt  wrote:
>
> Eric Engestrom  writes:
>
> > Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
> > time this macro is used.

This seems to be causing problems for me here on gcc8 (8.0.1 and
8.2.1) in Fedora 28.

./bin/texelFetch fs usampler2DMS 2

is failing here with:
Failed to compile fragment shader: 0:6(1): error: invalid input layout
qualifier used

gcc is probably broken, but we might want to revert his from the tree
and upcoming release until we can figure it out.

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-10-22 Thread Eric Anholt
Eric Engestrom  writes:

> Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
> time this macro is used.

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations

2018-10-16 Thread Eric Engestrom
Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
time this macro is used.

Signed-off-by: Eric Engestrom 
---
 src/util/bitset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/bitset.h b/src/util/bitset.h
index adafc72a5f74d46e118a..3b18abac793a0694c611 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -54,7 +54,7 @@
 #define BITSET_ONES(x) memset( (x), 0xff, sizeof (x) )
 
 #define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS)
-#define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS))
+#define BITSET_BIT(b) (1u << ((b) % BITSET_WORDBITS))
 
 /* single bit operations
  */
-- 
Cheers,
  Eric

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev