Serious bugs with lifted/nullable conversions from int, allowing conversion from decimal

I’m just replying to the first part of the question to start with. (I suggest that the second part should be a separate question; it’s more likely to be a bug.) There’s only an explicit conversion from decimal to int, but that conversion is being implicitly called in your code. The conversion happens in this … Read more

Why doesn’t volatile in java 5+ ensure visibility from another thread?

Update: For anyone interested this bug has been addressed and fixed for Java 7u6 build b14. You can see the bug report/fixes here Report Changeset Buglist Original Answer When thinking in terms of memory visibility/order you would need to think about its happens-before relationship. The important pre condition for b != 0 is for a … Read more

JDK 11.0.2 compilation fails with javac NPE on anonymous parameterized class type inference

Bug (JDK-8212586) has been already submitted and fixed in version 12. Minimal, verifiable example: public static void main(String[] args) { new Bug<>(){}; } static class Bug<T> { Bug() { test(new ParameterizedTypeReference<>(){}); } void test(ParameterizedTypeReference<T> typeReference) { } } Some Details. Fix has been also backported to JDK 11 – https://bugs.openjdk.java.net/browse/JDK-8220578. Available starting JDK 11.0.4.

What is the behavior of printing NULL with printf’s %s specifier?

First things first: printf is expecting a valid (i.e. non-NULL) pointer for its %s argument so passing it a NULL is officially undefined. It may print “(null)” or it may delete all files on your hard drive–either is correct behavior as far as ANSI is concerned (at least, that’s what Harbison and Steele tells me.) … Read more

(this == null) in C#!

This observation has been posted on StackOverflow in another question earlier today. Marc’s great answer to that question indicates that according to the spec (section 7.5.7), you shouldn’t be able to access this in that context and the ability to do so in C# 3.0 compiler is a bug. C# 4.0 compiler is behaving correctly … Read more

In release mode, code behavior is not as expected

This is interesting, at least from a historical perspective. I can reproduce the problem with VC 2008 (15.00.30729.01) and VC 2010 (16.00.40219.01) (targeting either 32-bit x86 or 64-bit x64). The problem doesn’t occur with any of the compilers I have tried starting with VC 2012 (17.00.61030). The command I used to compile: cl /Ox vc15-bug.cpp … Read more

Possible GCC bug when returning struct from a function

I don’t see any UB here; your types are unsigned so signed-overflow UB is impossible, and there’s nothing weird. (And even if signed, it would have to produce correct outputs for inputs that don’t cause overflow UB, like rdi=1). It’s broken with GCC’s C++ front-end as well. Also, GCC8.2 compiles it correctly for AArch64 and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)