Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,994 events total
2021-08-05 12:53:55 <dminuoso> guibou-: No, UB is something that happens with respect to the semantics of a particular programming language.
2021-08-05 12:54:22 <merijn> That, yeah
2021-08-05 12:54:28 <guibou-> merijn: Full disclosure: I'm just trying to help a collegue and I'm now digging in the middle of a part of the codebase that I had never seen before, so it will take a bit of time for me to relpace all the "unsafe" version of write ;)
2021-08-05 12:54:40 <merijn> also, UB (in C/C++ at least) retroactively invalidates the semantics of all preceding code :p
2021-08-05 12:54:46 <merijn> (fun times!)
2021-08-05 12:54:58 <dminuoso> guibou-: for instance, a memory read to an unmapped address is *very* *much* defined with respect to the linux memory model.
2021-08-05 12:55:56 <dminuoso> It will generate a SIGSEGV signal to the process that does the read.
2021-08-05 12:58:07 <dminuoso> The only "UB" I can see with an out-of-bounds access, is if your using the C backend. But if you're using native code generation, I'd say there's no "undefined behavior".
2021-08-05 12:58:28 <dminuoso> I'd just call it memory corruption. :-)
2021-08-05 12:58:28 × Gurkenglas quits (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) (Ping timeout: 272 seconds)
2021-08-05 12:59:09 <guibou-> dminuoso: yes, yes, sorry, I'm sure we are fighting with the same idea but improper (well, in my case) words ;) For example, I wanted to say that in C, reading array[offset] with offset "unknown" to the compiler is perfectly defined, it will read the value in memory at *(array + offset), and this is perfectly defined in the semantic of C, but will depends on the rest (OS, how the code was generated, ..).
2021-08-05 12:59:15 <guibou-> But if for example you write something such as int arr[8]; int i = 0; while(i <= 8){ arr[i] = 0; i++; } then you get undefined behavior because the compiler is authorised to replace that by an infinite loop (or anything, really ;)
2021-08-05 13:00:07 <dminuoso> guibou-: Give the link a read I mentioned above. :)
2021-08-05 13:00:08 × burnsidesLlama quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-05 13:00:08 burnside_ joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-08-05 13:00:18 <guibou-> dminuoso: thank you, I will.
2021-08-05 13:00:35 × vysn quits (~vysn@user/vysn) (Ping timeout: 258 seconds)
2021-08-05 13:01:07 alx741 joins (~alx741@186.178.109.254)
2021-08-05 13:01:41 lbseale joins (~lbseale@user/ep1ctetus)
2021-08-05 13:02:29 Guest7988 joins (~Guest79@88.123.18.247)
2021-08-05 13:04:13 Atum_ joins (~IRC@user/atum/x-2392232)
2021-08-05 13:05:36 gehmehgeh joins (~user@user/gehmehgeh)
2021-08-05 13:08:35 Tuplanolla joins (~Tuplanoll@91-159-69-50.elisa-laajakaista.fi)
2021-08-05 13:09:20 favonia joins (~favonia@user/favonia)
2021-08-05 13:10:07 × mikoto-chan quits (~mikoto-ch@ip-193-121-10-50.dsl.scarlet.be) (Quit: mikoto-chan)
2021-08-05 13:10:10 × xff0x_ quits (~xff0x@2001:1a81:5296:aa00:b4be:dba3:8175:6a33) (Ping timeout: 258 seconds)
2021-08-05 13:10:24 mikoto-chan joins (~mikoto-ch@ip-193-121-10-50.dsl.scarlet.be)
2021-08-05 13:11:09 <merijn> guibou-: Eh, if the unknown offset is out of bounds, that is *not* defined behaviour in C
2021-08-05 13:11:09 xff0x_ joins (~xff0x@2001:1a81:5296:aa00:7160:64f8:3763:f62c)
2021-08-05 13:11:20 <[exa]> dminuoso: wow that site is a good read
2021-08-05 13:13:44 × qbt quits (~edun@user/edun) (Quit: Leaving)
2021-08-05 13:17:36 <guibou-> merijn: Indeed, however if the offset is not "Known" at compile time, and if it cannot be infered in any way, the compiler can only assume "defined" behavior, and do the obvious "read memory at offset X". (Well, it can technically introduces a bound check and launch nuclear missiles in the out of bound case, but the point of compilers is not to generate crappy code ;). However, if the offset (or its
2021-08-05 13:17:42 <guibou-> domain) are known in any way, optimisations passes may (wrongly) make invalid transformations
2021-08-05 13:18:22 <guibou-> (and I'll finish the read proposed by dminuoso before contining this discussion ;) Both are super inetresting)
2021-08-05 13:18:35 <merijn> That's...not what defined behaviour means, though
2021-08-05 13:20:30 burnsidesLlama joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-08-05 13:20:40 × burnside_ quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-05 13:20:40 × burnsidesLlama quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-05 13:20:57 burnsidesLlama joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-08-05 13:22:09 <guibou-> merijn: sorry, I insisted a bit, certainly too much. I'll go back to my debuging and admit that I'm unclear about UB. ;)
2021-08-05 13:23:26 burnside_ joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-08-05 13:23:26 × burnsidesLlama quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-05 13:23:48 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 272 seconds)
2021-08-05 13:24:40 × Obo quits (~roberto@70.pool90-171-81.dynamic.orange.es) (Quit: WeeChat 2.8)
2021-08-05 13:24:57 Obo joins (~roberto@70.pool90-171-81.dynamic.orange.es)
2021-08-05 13:28:37 × Vajb quits (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) (Read error: Connection reset by peer)
2021-08-05 13:28:48 peterhil joins (~peterhil@mobile-access-5d6aa6-103.dhcp.inet.fi)
2021-08-05 13:28:53 × aman quits (~aman@user/aman) (Quit: aman)
2021-08-05 13:29:47 Vajb joins (~Vajb@n2bovg6licdnldblt-2.v6.elisa-mobile.fi)
2021-08-05 13:30:45 × Guest7988 quits (~Guest79@88.123.18.247) (Quit: Client closed)
2021-08-05 13:30:45 × kuribas quits (~user@ptr-25vy0i8nm8p7ix7m4oi.18120a2.ip6.access.telenet.be) (Quit: ERC (IRC client for Emacs 26.3))
2021-08-05 13:32:10 × lbseale quits (~lbseale@user/ep1ctetus) (Quit: Leaving)
2021-08-05 13:35:34 × hendursa1 quits (~weechat@user/hendursaga) (Quit: hendursa1)
2021-08-05 13:35:57 <tomsmeding> guibou-: while getting the definitions of terms like "undefined behaviour" straight is good, it ultimately distracts from trying to find your bug :p
2021-08-05 13:36:03 stevenxl joins (uid133530@id-133530.highgate.irccloud.com)
2021-08-05 13:37:07 hendursaga joins (~weechat@user/hendursaga)
2021-08-05 13:38:33 × slavaqq quits (~slavaqq@sdmail.sdserver.cz) (Quit: Client closed)
2021-08-05 13:44:32 xsperry joins (~as@user/xsperry)
2021-08-05 13:47:28 × mastarija quits (~mastarija@78-3-210-70.adsl.net.t-com.hr) (Quit: Leaving)
2021-08-05 13:48:13 slack1256 joins (~slack1256@181.203.123.157)
2021-08-05 13:50:03 <guibou-> And you know what? index out of bounds (6,4) ;) Ok, let's not accuse GHC of my own mistake (well, I'm happy here, I'm new on that codebase, that's not my fault, but I should have thought about this reason before accusing GHC ;)
2021-08-05 13:50:41 time joins (~time@202.14.121.94)
2021-08-05 13:50:50 <time> hi
2021-08-05 13:51:14 × gehmehgeh quits (~user@user/gehmehgeh) (Quit: Leaving)
2021-08-05 13:52:00 × time quits (~time@202.14.121.94) (Remote host closed the connection)
2021-08-05 13:53:26 time joins (~time@202.14.121.94)
2021-08-05 13:53:44 × kspalaiologos quits (~kspalaiol@user/kspalaiologos) (Quit: Leaving)
2021-08-05 13:53:50 ubert joins (~Thunderbi@91.141.45.149.wireless.dyn.drei.com)
2021-08-05 13:54:17 Meh joins (~Meh@202.14.121.94)
2021-08-05 13:54:40 Meh is now known as Guest378
2021-08-05 13:55:27 × time quits (~time@202.14.121.94) (Read error: Connection reset by peer)
2021-08-05 13:55:41 time joins (~time@202.14.121.94)
2021-08-05 13:57:03 × time quits (~time@202.14.121.94) (Read error: Connection reset by peer)
2021-08-05 13:58:29 × mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Ping timeout: 252 seconds)
2021-08-05 13:59:31 xerox is now known as xeroxOutdoors
2021-08-05 13:59:37 × dajoer quits (~david@user/gvx) (Quit: leaving)
2021-08-05 13:59:42 xeroxOutdoors is now known as xerox
2021-08-05 14:03:04 × pbrisbin quits (~patrick@pool-108-52-124-197.phlapa.fios.verizon.net) (Ping timeout: 258 seconds)
2021-08-05 14:03:42 amahl joins (~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi)
2021-08-05 14:03:52 ukari joins (~ukari@user/ukari)
2021-08-05 14:06:03 × Guest378 quits (~Meh@202.14.121.94) (Quit: Connection closed)
2021-08-05 14:08:16 shapr joins (~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-08-05 14:09:02 burnsidesLlama joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-08-05 14:09:03 × burnside_ quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-05 14:09:47 burnside_ joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-08-05 14:09:47 × burnsidesLlama quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-05 14:11:22 × jgeerds quits (~jgeerds@55d45555.access.ecotel.net) (Ping timeout: 240 seconds)
2021-08-05 14:14:54 slac49620 joins (~slack1256@181.203.118.140)
2021-08-05 14:15:42 × slac49620 quits (~slack1256@181.203.118.140) (Remote host closed the connection)
2021-08-05 14:16:56 × slack1256 quits (~slack1256@181.203.123.157) (Ping timeout: 250 seconds)
2021-08-05 14:17:26 mastarija joins (~mastarija@78-3-210-70.adsl.net.t-com.hr)
2021-08-05 14:17:55 <mastarija> So, why exactly is Haskell unable to unify the types in this case?
2021-08-05 14:17:59 <mastarija> class Eg m v x o where eg :: (v -> m x) -> v -> o
2021-08-05 14:18:02 <mastarija> instance Monad m => Eg m v x (m x) where eg f v = f v
2021-08-05 14:18:08 <mastarija> test :: forall m. Monad m => m Char
2021-08-05 14:18:11 <mastarija> test = eg @m (const $ return 'a') (1::Int)
2021-08-05 14:18:26 <mastarija> I have to explicitly write type application to unify the m
2021-08-05 14:18:38 Guest25 joins (~Guest25@88.123.18.247)
2021-08-05 14:19:06 <mastarija> It seems like, if I have a class parameter that is composed of other class parameters, unification fails
2021-08-05 14:19:22 × MidAutumnHotaru quits (~MidAutumn@user/midautumnmoon) (Quit: Leaving for a break - theLounge)

All times are in UTC.